Fill in info from a form

Noreene Patrick

Registered User.
Local time
Today, 02:09
Joined
Jul 18, 2002
Messages
223
I have a form that fills in a table and I need to ask what code would I use for the on close event of the form so it will fill in the same expectedhours for that picker on this date() in the table.

Example: If picker id #327 had 7.5 expectedhours on first entry for date(), then the expectedhours would be the same every time the pickerid was entered on date().. I am trying to save keystrokes for supervisor...

The picker can be in and out of the function several times a day but the expected hours would be the same...and with many pickers on each shift sometimes the supervisor doesnt remember exactly how many hours are expected for each individual picker.

Does that make sense?

Thanks for your help, Noreene
 
Something like:

Code:
Me.MyTextbox = Nz(DLookup("MyField", "tblPickers", "PickerID = " & Me.txtPickerID), 0)

And put it in the BeforeUpdate event; not the Close event. The records aren't there anymore by the time that event is triggered.
 
Mile-O-Phile

Thanks for the quick answer!!

It is giving me an error that says data type mismatch in criteria expression..

Could you tell me what each component of the code means so maybe I can figure out the problem?

Thanks again, Noreene
 
Me.tblexpectedhours = DLookup("tblexpectedhours", "tbllogcomplete", "tblpickerid = " & Me.tblPickerid)

Okay, so let me see if I understand what this code is saying;

I want it to look at expectedhours field on the form and then lookup that same field in table logcomplete, where the pickerid in table equals pickerid on form and put in that expected hour from the table to the new entry on form?

Two questions. Is the lookup going to look for the most current pickerid in the table (that is, like date()?) and

If I have a combo box on my form that looks up the name from another table but puts the pickerid# as the bound column, is this going to change the criteria that says me.tblpickerid? (since the actual visible text in that field on the form is not the id# but the name.

Thanks again for all your help

Noreene
 

Users who are viewing this thread

Back
Top Bottom