Refresh form contol when record has changed in a table

G

Guest

I have a yes/no fieldA in a tableA. I have an unbound controlA in formA using
dlookup to get the yes/no value from a particular record in tableA. This
works great.

My problem is that if a user opens tableA and changes the yes/no value,
while formA is still open, I need controlA to immediately reflect the change.
It will currently only refresh if I close and reopen formA. ControlB on
formA calculates depending on the yes/no field value in tableA and I need
that value to change if the yes/no value in tableA changes. I've created a
macro that requeries controlA and ran the macro in the on current of formA
but that doesn't work. Is there a way I can do this?

My on current code is: DoCmd.RunMacro "RequeryGateway3", 1, 1

Thanks much -
Alex
 
M

Marshall Barton

Alex said:
I have a yes/no fieldA in a tableA. I have an unbound controlA in formA using
dlookup to get the yes/no value from a particular record in tableA. This
works great.

My problem is that if a user opens tableA and changes the yes/no value,
while formA is still open, I need controlA to immediately reflect the change.
It will currently only refresh if I close and reopen formA. ControlB on
formA calculates depending on the yes/no field value in tableA and I need
that value to change if the yes/no value in tableA changes. I've created a
macro that requeries controlA and ran the macro in the on current of formA
but that doesn't work. Is there a way I can do this?

My on current code is: DoCmd.RunMacro "RequeryGateway3", 1, 1


No good way to do this.

You have to execute the DLookup to get the changed value. I
suppose you could do that in the form's Timer event, but
that seems like a lot of overhead to deal with users going
around to the back door and editing a table they shouldn't
even know exists.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top