combo box to automate related text fields (1 Viewer)

Purdue22

Registered User.
Local time
Today, 09:51
Joined
May 11, 2001
Messages
25
combo box to automate related text fields

This is my situation. I created a form that provides me with record information from my Call Log table. I have a combo box with a list of dealers. In a seperate table called Dealer Info I have the fields: "Dealer", "Fax", "Phone#", and "Technical Communicator". When I select the dealer from the combo box I want it to automatically find the dealer in the Dealer Info table and place the Fax, Phone, and Technical Communicator in there respective text fields. Could you supply me with the code that accomplishes this.

Thanks
 

charityg

Registered User.
Local time
Today, 09:51
Joined
Apr 17, 2001
Messages
634
combobox afterupdate
dim db as database
dim rst as recordset
set db=currentdb
set rst=db.openrecordset("dealertable")
rst.findfirst "[dealer]='" & combobox & "'"
with rst
if .nomatch then
msgbox "Dealer not found!"
else
me!fax=!fax
me!technicalcomm=!technicalcomm
me!phone=!phone
end with


[This message has been edited by charityg (edited 05-11-2001).]
 

Purdue22

Registered User.
Local time
Today, 09:51
Joined
May 11, 2001
Messages
25
I am getting the error End with without With. Do you have any suggestions?
 

charityg

Registered User.
Local time
Today, 09:51
Joined
Apr 17, 2001
Messages
634
combobox afterupdate
dim db as database
dim rst as recordset
set db=currentdb
set rst=db.openrecordset("dealertable")
rst.findfirst "[dealer]='" & combobox & "'"
with rst
if .nomatch then
msgbox "Dealer not found!"
else
me!fax=!fax
me!technicalcomm=!technicalcomm
me!phone=!phone
end if
end with

Sorry! I forgot my end if! I didn't guarantee the code would be bug free!
 

Users who are viewing this thread

Top Bottom