Using IIF and macros

A

Arlen

I want Four of the fields in my form are: [TypeLv], [TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user select
(combo box) the type of leave and then key in the number of hours for that
type and then press the Enter key. On that event, have Access look back at
the type of leave selected and decide where to copy the TimeChg data: to the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user to the next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change what I need
to consider for the macro? Any help would be appreciated.
 
S

Steve Huff

Why have 4 fields? If you are storing the Type of leave in the field TypeLV
and you have the time charge field why do you need to also store the
informaiton in the other two fields? Seems like you are storing redundant
data.

-Steve Huff
http://www.huffs.us
 
L

Lynn Trapp

If you store the type of leave in [TypeLv], then you should not need to also
store it in the other 2 fields.
 
A

Arlen

Hi, Steve Appreciate the very fast reply. I'm just NOT a great
communicator. I don't want to "store" the [TimeChg] form field entries
anywhere; just want to use the form entry in an IIF macro to store the entry
in the correct type of leave fields [TimeChgAL] or [TimeChgSL]. Thanks for
your comments, though (I had a field in the Transaction Table for [TimeChg],
but I will delete it because it does not need to be stored!) However, I DO
want to store the other two fields' numbers into my Transactions table. This
would mean, I'm guessing, that the form field [TimeChg] will need to be an
unbound text box control.

Steve Huff said:
Why have 4 fields? If you are storing the Type of leave in the field TypeLV
and you have the time charge field why do you need to also store the
informaiton in the other two fields? Seems like you are storing redundant
data.

-Steve Huff
http://www.huffs.us

Arlen said:
I want Four of the fields in my form are: [TypeLv], [TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user select
(combo box) the type of leave and then key in the number of hours for that
type and then press the Enter key. On that event, have Access look back at
the type of leave selected and decide where to copy the TimeChg data: to the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user to the next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change what I need
to consider for the macro? Any help would be appreciated.
 
A

Arlen

Hi, Lynn Apologizing for using the same basic response I sent to Steve on
this subject, but I also appreciate your very fast reply. I'm just NOT a
great communicator. I don't want to "store" the [TimeChg] form field entries
anywhere; just want to use the form entry in an IIF macro to store the entry
in the correct type of leave fields [TimeChgAL] or [TimeChgSL]. Thanks for
your comments, though (I had a field in the Transaction Table for [TimeChg],
but I will delete it because it does not need to be stored!) However, I DO
want to store the other two fields' numbers into my Transactions table. This
would mean, I'm guessing, that the form field [TimeChg] will need to be an
unbound text box control.

Lynn Trapp said:
If you store the type of leave in [TypeLv], then you should not need to also
store it in the other 2 fields.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
I want Four of the fields in my form are: [TypeLv], [TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user select
(combo box) the type of leave and then key in the number of hours for that
type and then press the Enter key. On that event, have Access look back at
the type of leave selected and decide where to copy the TimeChg data: to the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user to the next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change what I need
to consider for the macro? Any help would be appreciated.
 
L

Lynn Trapp

Arlen,
I'm not quite sure what you mean by an IIF Macro. You can use an IIF
statement in a query but I have never heard of an IIF Macro.

I think Steve and I both think you DO need to store the [TimeChg] data but
not the [TimeChgAL] and the [TimeChgSL]. If you have these 2 types in your
Type field then you can run a query any time to determine which of these 2
types you need.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
Hi, Lynn Apologizing for using the same basic response I sent to Steve on
this subject, but I also appreciate your very fast reply. I'm just NOT a
great communicator. I don't want to "store" the [TimeChg] form field entries
anywhere; just want to use the form entry in an IIF macro to store the entry
in the correct type of leave fields [TimeChgAL] or [TimeChgSL]. Thanks for
your comments, though (I had a field in the Transaction Table for [TimeChg],
but I will delete it because it does not need to be stored!) However, I DO
want to store the other two fields' numbers into my Transactions table. This
would mean, I'm guessing, that the form field [TimeChg] will need to be an
unbound text box control.

Lynn Trapp said:
If you store the type of leave in [TypeLv], then you should not need to also
store it in the other 2 fields.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
I want Four of the fields in my form are: [TypeLv], [TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user select
(combo box) the type of leave and then key in the number of hours for that
type and then press the Enter key. On that event, have Access look
back
at
the type of leave selected and decide where to copy the TimeChg data:
to
the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user to
the
next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change what
I
need
to consider for the macro? Any help would be appreciated.
 
A

Arlen

Use of IIF meant to be part of an Event macro ... sorry about the poor use of
the term.

I like your thoughts on how to treat the [TimeChg] option. I have to
distinguish in my reports which type of leave was charged, but the method you
suggest should let me do that. I'll play with it and see.

Thanks for the feedback!

Lynn Trapp said:
Arlen,
I'm not quite sure what you mean by an IIF Macro. You can use an IIF
statement in a query but I have never heard of an IIF Macro.

I think Steve and I both think you DO need to store the [TimeChg] data but
not the [TimeChgAL] and the [TimeChgSL]. If you have these 2 types in your
Type field then you can run a query any time to determine which of these 2
types you need.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
Hi, Lynn Apologizing for using the same basic response I sent to Steve on
this subject, but I also appreciate your very fast reply. I'm just NOT a
great communicator. I don't want to "store" the [TimeChg] form field entries
anywhere; just want to use the form entry in an IIF macro to store the entry
in the correct type of leave fields [TimeChgAL] or [TimeChgSL]. Thanks for
your comments, though (I had a field in the Transaction Table for [TimeChg],
but I will delete it because it does not need to be stored!) However, I DO
want to store the other two fields' numbers into my Transactions table. This
would mean, I'm guessing, that the form field [TimeChg] will need to be an
unbound text box control.

Lynn Trapp said:
If you store the type of leave in [TypeLv], then you should not need to also
store it in the other 2 fields.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I want Four of the fields in my form are: [TypeLv],
[TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user
select
(combo box) the type of leave and then key in the number of hours for that
type and then press the Enter key. On that event, have Access look back
at
the type of leave selected and decide where to copy the TimeChg data: to
the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user to the
next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change what I
need
to consider for the macro? Any help would be appreciated.
 
L

Lynn Trapp

Good luck with it. Let us know if you need more help.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
Use of IIF meant to be part of an Event macro ... sorry about the poor use of
the term.

I like your thoughts on how to treat the [TimeChg] option. I have to
distinguish in my reports which type of leave was charged, but the method you
suggest should let me do that. I'll play with it and see.

Thanks for the feedback!

Lynn Trapp said:
Arlen,
I'm not quite sure what you mean by an IIF Macro. You can use an IIF
statement in a query but I have never heard of an IIF Macro.

I think Steve and I both think you DO need to store the [TimeChg] data but
not the [TimeChgAL] and the [TimeChgSL]. If you have these 2 types in your
Type field then you can run a query any time to determine which of these 2
types you need.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Arlen said:
Hi, Lynn Apologizing for using the same basic response I sent to
Steve
on
this subject, but I also appreciate your very fast reply. I'm just NOT a
great communicator. I don't want to "store" the [TimeChg] form field entries
anywhere; just want to use the form entry in an IIF macro to store the entry
in the correct type of leave fields [TimeChgAL] or [TimeChgSL].
Thanks
for
your comments, though (I had a field in the Transaction Table for [TimeChg],
but I will delete it because it does not need to be stored!) However,
I
DO
want to store the other two fields' numbers into my Transactions
table.
This
would mean, I'm guessing, that the form field [TimeChg] will need to be an
unbound text box control.

:

If you store the type of leave in [TypeLv], then you should not need
to
also
store it in the other 2 fields.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I want Four of the fields in my form are: [TypeLv],
[TimeChg],[TimeChgAL],
and [TimeChgSL]. What I'd like to be able to do is let the form user
select
(combo box) the type of leave and then key in the number of hours
for
that
type and then press the Enter key. On that event, have Access
look
back
at
the type of leave selected and decide where to copy the TimeChg
data:
to
the
[TimeChgAL] (annual leave) or [TimeChgSL] (sick leave). Also, the process
would not allow tabbing into these two fields, but take the user
to
the
next
leave transaction record. So far, no joy. I'm also concerned with
referencing a combo box data entry on the form--does this change
what
I
need
to consider for the macro? Any help would be appreciated.
 
Top