Yet another DLookup question?

S

seremsc

MS Access 2000
Imagine an uniquely identified inventory that goes out to a customer, is
returned, and checked back in. Kind of a library. I have a mainform that
contains a unique ID that I would like to pass to a subform that lists my
inventory (and would link that inventory item to the mainform for the time it
is checked-out). My hope is to query a unique ID, and come up with what
inventory items have been checked out to that ID.
**
Mainform - UniqueID

Subform - Check-box to check item out
Subform - Control to be automatically filled in with the mainform unique ID
when I click the checked-out box.
**
I think I need some VBA code in my check-box's OnClick or OnExit with a
DLookup function, but I am having trouble searching the existing threads for
help.
Thanks,
Gregory
 
G

Gijs Beukenoot

From seremsc :
MS Access 2000
Imagine an uniquely identified inventory that goes out to a customer, is
returned, and checked back in. Kind of a library. I have a mainform that
contains a unique ID that I would like to pass to a subform that lists my
inventory (and would link that inventory item to the mainform for the time it
is checked-out). My hope is to query a unique ID, and come up with what
inventory items have been checked out to that ID.
**
Mainform - UniqueID

Subform - Check-box to check item out
Subform - Control to be automatically filled in with the mainform unique ID
when I click the checked-out box.
**
I think I need some VBA code in my check-box's OnClick or OnExit with a
DLookup function, but I am having trouble searching the existing threads for
help.
Thanks,
Gregory

You can use the click-event but instead of dlookup, you can use a macro
to do a setvalue from the value on mainform to the 'box' on the
subform. Then (probably) requery the subform to show the correct
(linked) items. Am I making sense?
 
S

seremsc

You can use the click-event but instead of dlookup, you can use a macro
to do a setvalue from the value on mainform to the 'box' on the
subform. Then (probably) requery the subform to show the correct
(linked) items. Am I making sense?

I think I understand the big picture. Can the "requery" for the subform be
written into the setvalue macro, or do I need a distinct macro (does my
question expose my ignorance)?
I will do some experimenting. Thanks so much.
Gregory
 
S

seremsc

Macro magic! Thanks, that was easy to use the setvalue function. Now, is
there a way I can get the value to clear if I unclick my check-box?
Gregory
 
J

John Vinson

Macro magic! Thanks, that was easy to use the setvalue function. Now, is
there a way I can get the value to clear if I unclick my check-box?

Setvalue to NULL.

John W. Vinson[MVP]
 
G

Gijs Beukenoot

From seremsc :
I think I understand the big picture. Can the "requery" for the subform be
written into the setvalue macro, or do I need a distinct macro (does my
question expose my ignorance)?
I will do some experimenting. Thanks so much.
Gregory

Yes you can do many (I think 255) actions in on macro, even make them
conditional ([formvalue] > 10) and give them labels runmacro
mymacro.part2
 
S

seremsc

Thank you so so much for your patience. One of these days, I will be
familiar enough with the different processes to drill down to the information
I need in the MS help box. Until then, much thanks.
Gregory
 
Top