Combo Box Updating 2 fields

  • Thread starter Thread starter Arnie
  • Start date Start date
A

Arnie

Is there a way to update two fields at the same time in a form while using a
combo box.
I have a training database and have created a course code translation table.
The table has 2 columns 1- course description and column 2 - course code.
In the form I want to be able to click on the course description and have
this update course description and course code in another table.
 
You could do it a few ways...

2 can think of off the top of my head are:
A) Put a subform on the form and link it to the 2nd table. Then pass
me!Combo1(0) to one text box and me!Combo1(1) to another.

B) You can open the tables using ADO or DAO and add it straight to the
table on the AfterUpdate event of the combo box. i.e.

Sub Combo1_AfterUpdate
dim db as database
dim rec as recordset

set db = currentDB
set rec = db.openrecordset("TableName")

rec.addnew
rec("CourseCode") = me.Combo1(0)
rec("CourseDesc") = me.Combo1(1)
rec.update

End Sub
 
I tried using the code to add it straight into the table afterupdate but I
get a
Run time error
Type mismatch

I've never coded anything before so I have no idea what this means.
The records I'm trying to update are Text in the table where the combo box is
pulling
the information from and text in table I'm trying updating.
(I'm using Access 2000 so I'm not sure if this makes a difference).
Any Help would be appreciated.
 
Back
Top