Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A unbound field to Populate fields in a form

Status
Not open for further replies.

RachelK

Programmer
Mar 18, 2002
171
0
0
GB
Hi,

I have a form that has a persons work address on it. I have a table that has address of companies that could possibly be there work address and the two are not related.

I would like the user to select the combo box which is txtCentreNo that has the 1st colum bound to CPID if this textbox is null I would like the user to be able to enter the address manually otherwise if they select a value from the combo box, I would like the form to be populated automatically. I have got this far and it's not working:-

If Not IsNull(txtCentreNo) Then
Me.WorkAdd1 = DLookup("ADD1", "tblCourseProvider", "CPID = '" & [CPID] & "'")
Else
MsgBox "No Centre"
End If


I am not sure about the first CPID I am trying to say that if the value in txtCentreNo 1st column is ie 100 then look the value up in the tblCourseProviders.

Any idea's where I am going wrong. Thanks Rachel.
 
eh, not 100% clear on what you are saying, but...

shouldn't your condition in DLookup be: CPID = '" & [txtCentreNo] & "'")
or am I confusing your combobox and your textboxes...

also, how is it not working? not giving the correct values or giving an error?

Procrastinate Now!
 
Crowley16,

Thank you. You was right my Dlookup was the wrong way round. Thanks again Rachel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top