problems with VB code (2 Viewers)

Purdue22

Registered User.
Local time
Today, 07:11
Joined
May 11, 2001
Messages
25
I received help from this site yesterday, but I am still having problems with the code. I will try and describe my situation. I have two tables, Dealer Info and Call Log. In my form I have a combo box that should provide a list of the dealers in the Dealer Info table. When I select the dealer name from the combo box I want it to grab the dealer information from the Dealer Info table, which is fax, phone, and technical communicator, and display it on the form. I want it to also store the dealer name in the call log table, but I only want the fax, phone, and tech comm viewed on the form for that record. The problem I am having with the code is it is changing information in the dealer info table and in the call log table. In the call log table it is adding the dealer name to the appropriate record, but it is also changing the dealer name of the first record of the table or it may even add a number in place of the name.

Can you help?

here is the code for the combo box:

Private Sub cmbDealer_AfterUpdate()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("Dealer Info")
rst.Index = "Dealer Name"

rst.Seek "=", Me!cmbDealer

If rst.NoMatch Then
MsgBox "Dealer not found!"
Else
Me!Dealer = rst![Dealer Name]
Me!fax = rst![Fax Number]
Me!tc = rst![Technical Communicator]
Me!phone = rst![Phone Number]
End If
End Sub
 

chadt

Registered User.
Local time
Today, 07:11
Joined
Jan 9, 2001
Messages
20
is the form bound to any of the tables?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:11
Joined
Feb 19, 2002
Messages
43,302
It would have been more helpful to have continued the original thread so we could see what had already been suggested.
 

charityg

Registered User.
Local time
Today, 07:11
Joined
Apr 17, 2001
Messages
634
I helped resolve the issues through email. It was a working process, but I think we got it!
 

Users who are viewing this thread

Top Bottom