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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically fill out a textbox

Status
Not open for further replies.

wshs

Programmer
Nov 22, 2005
220
US
below is afterupdate event of txtad

Me.cboContName = _
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "' AND AddContNo='" & Me!txtad & "'")

I was two blank textboxes and a combo box on a form.
txtContNo, txtad, and cboContName.

I want to look up the table to find the correct "contract name" by filtering ContractNo and AddContNo.
This worked find when I had just
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "'")
But I realized table can carry multiple contract numbers with different addendum number. So now I need to find a way to find the corresponding contract name using both fields.

This is how the form should work. User types in the Contract Number and the addendum number and then cboContName returns a value automatically.

what am i doing wrong? any help would be great. thx
 
If AddContNo is defined as numeric in tbl_PSC:
DLookup("ContractName", "tbl_PSC", "ContractNo='" & Me!txtContNo & "' AND AddContNo=" & Me!txtad)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
well.. i've tried that too but it keeps saying
You canceled previoius operation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top