Trouble with a simple dlookup

Noreene Patrick

Registered User.
Local time
Today, 09:56
Joined
Jul 18, 2002
Messages
223
I am trying to use dlookup to fill an unbound textbox on my form. I know I am doing a simple thing wrong and I cant figure out what it is.

My form has a field from table(m5Warehouse) called M5Location. It is a bin location. My form has an unbound textbox called BinMax.

I have a table called tblbinmax that has 2 columns. Binnumber(same as m5location) and binmax(maxinum number of pallets that can be placed in bin)

When i fill in M5location on my form, I wanted code to fire on afterupdate to look in tblbinmax, look at the binnumber and put in the value in unbound textbox called BinMax.

This is my code: me.binmax.Value = DLookup("[binmax]", "tblbinmax", "[binnumber] =" & Me.M5Location)

I have tried every way i can figure to make this work, and i keep getting error message, name?#, etc. I get error msg 3075 and error msg 2001...PLEASE HELP!!
 
I personnaly would write aquery that selects the two columns from the table,
(binmax and binnumber) in the criteria section of the binnumber column type
forms ![yourform]![M5location].

in the after update event of M5location type this

Dim Nodata as string

nodata = nz(dlookup("[columnfrom query]","[queryname]"),"")

If you need to you can check if ther is a value in nodata

Yourformfield = nodata
 
Thank you so very much...that worked!!!
 

Users who are viewing this thread

Back
Top Bottom