Help with Auto Populate

N

Nick

2nd request... If anyone has any ideas I would really appreciate the
pointers.


I have a data entry form with several text and combo boxes, that are bound
to a table called "Jobs". I would like to autopopulate some information on
the form prior to users adding a record. There is a secondary table,
"JobInfo", that contains the following information:

JobNumber
Suffix
ItemNumber
Quantity

I would like for the user to be able to enter the JobNumber and Suffix, and
upon entering the suffix, to have ItemNumber and Quantity autopopulate. I
have written code to do this but it is returning a #NAME? error.

Could someone give me a bit of guidance? Any help would be appreciated.

Thanks in advance,

Nick C.
 
D

Dan Artuso

Hi,
This may work for you.
In the after update event of your Suffix control try this:

Me.ItemNumber = DLookup("[ItemNumber]","JobInfo","[JobNumber] = " & _
Me.JobNumber & " And [Suffix] = '" & Me.Suffix & "'")

Me.Quantity = DLookup("[Quantity]","JobInfo","[JobNumber] = " & _
Me.JobNumber & " And [Suffix] = '" & Me.Suffix & "'")

I've assumed that JobNumber is numeric and Suffix is a string.
If that's not correct, just remember, numbers need no delimiters and
strings need to be delimited with single quotes.
 
N

Nick C

Dan, thank you, that worked very well!

Nick C.


Dan Artuso said:
Hi,
This may work for you.
In the after update event of your Suffix control try this:

Me.ItemNumber = DLookup("[ItemNumber]","JobInfo","[JobNumber] = " & _
Me.JobNumber & " And [Suffix] = '" & Me.Suffix & "'")

Me.Quantity = DLookup("[Quantity]","JobInfo","[JobNumber] = " & _
Me.JobNumber & " And [Suffix] = '" & Me.Suffix & "'")

I've assumed that JobNumber is numeric and Suffix is a string.
If that's not correct, just remember, numbers need no delimiters and
strings need to be delimited with single quotes.
--
HTH
Dan Artuso, Access MVP


2nd request... If anyone has any ideas I would really appreciate the
pointers.


I have a data entry form with several text and combo boxes, that are bound
to a table called "Jobs". I would like to autopopulate some information on
the form prior to users adding a record. There is a secondary table,
"JobInfo", that contains the following information:

JobNumber
Suffix
ItemNumber
Quantity

I would like for the user to be able to enter the JobNumber and Suffix, and
upon entering the suffix, to have ItemNumber and Quantity autopopulate. I
have written code to do this but it is returning a #NAME? error.

Could someone give me a bit of guidance? Any help would be appreciated.

Thanks in advance,

Nick C.
 

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