Connecting Tech Pros Worldwide Forums | Help | Site Map

Dlookup problem

mmorgan1240@sbcglobal.net
Guest
 
Posts: n/a
#1: Jan 10 '06
I have a form that I am trying to update. I would like to have a field
populated by another table (State_laws) based on the value of another
field on the form.
I have a field called "state". When the user inputs a state I would
like another field to be populated based on the lookup of another table
based on the state. I am getting the value &name in my new unbound text
box. Here is my dlookup statement please help me figure out what I am
doing wrong.
=dlookup("State law","state_laws","State=" & state)Do I need a trigger
associated with the new field or the state field to kick off this
lookup?
Thank you for any help.

salad
Guest
 
Posts: n/a
#2: Jan 10 '06

re: Dlookup problem


mmorgan1240@sbcglobal.net wrote:[color=blue]
> I have a form that I am trying to update. I would like to have a field
> populated by another table (State_laws) based on the value of another
> field on the form.
> I have a field called "state". When the user inputs a state I would
> like another field to be populated based on the lookup of another table
> based on the state. I am getting the value &name in my new unbound text
> box. Here is my dlookup statement please help me figure out what I am
> doing wrong.
> =dlookup("State law","state_laws","State=" & state)Do I need a trigger
> associated with the new field or the state field to kick off this
> lookup?
> Thank you for any help.
>[/color]
Remember...strings surrounded by quotes, dates by #, numbers by nothing

intNum = 1
dat = Date()
sn = "MN"
? "state = """ & SN & ""
state = "MN
? "state = '" & sn & "'"
? "datefld = #" & dat & "#"
? "Numfield = " & intnum
mmorgan1240@sbcglobal.net
Guest
 
Posts: n/a
#3: Jan 10 '06

re: Dlookup problem


Salad, thanks for your reply. Do I need some kind of event trigger to
get this to happen? Or will the dlookup happen as soon as the state
field is populated?
Thanks again.

salad
Guest
 
Posts: n/a
#4: Jan 10 '06

re: Dlookup problem


mmorgan1240@sbcglobal.net wrote:
[color=blue]
> Salad, thanks for your reply. Do I need some kind of event trigger to
> get this to happen? Or will the dlookup happen as soon as the state
> field is populated?
> Thanks again.
>[/color]
I'll assume that is your control source for the field. So, yes it
should update correctly. If it doesn't, a simple fix is to requery the
field. Let's say the Text field is called Text1 with the dlookup and
the input field is called Input1. In the Input1 AfterUpdate you can enter
Me.Text1.Requery
Closed Thread


Similar Microsoft Access / VBA bytes