visualsander
Oct 19th, 2000, 03:57 AM
Hi group,
please help me out with this one.
I am using ADO
I have a combobox on a form.
The combobox is filled with all records from the table tblFUNCTION. This table has 2 fields:
FunctionID (Primary Key)
Description
I also have a table tblEMPLOYEE. This table has the following fields:
employeeID
Name
FunctionID
etc.
etc.
etc.
The tables are linked via the field FunctionID.
I use this code to show both fields (FunctionID & Description) in the combobox:
cboFunctionID.Clear
Do Until rstMedFunctionID.EOF
cboFunctie.AddItem rstMedFunctie.Fields("FunctionID") & " " & rstMedFunctie.Fields("Description")
rstMedFunction.MoveNext
Loop
I use this code to save the new record:
Dim sFunction,sID,sName As String
sID = txtMedewerkerID
sName = txtName
sFunction = cboFunction
rstEmployee.AddNew
rstEmployee!EmployeeID = sID
rstEmployee!name = sName
rstEmployee!FunctionID = sFunction(This line gives an error)
rstEmployee.Update
MY QUSTION:
When I select a function using the combobox, how in Gods name, do I save the functionID in the table tblEmployee???
If something isn't clear do ask!
Thanks in advance!
Sander
please help me out with this one.
I am using ADO
I have a combobox on a form.
The combobox is filled with all records from the table tblFUNCTION. This table has 2 fields:
FunctionID (Primary Key)
Description
I also have a table tblEMPLOYEE. This table has the following fields:
employeeID
Name
FunctionID
etc.
etc.
etc.
The tables are linked via the field FunctionID.
I use this code to show both fields (FunctionID & Description) in the combobox:
cboFunctionID.Clear
Do Until rstMedFunctionID.EOF
cboFunctie.AddItem rstMedFunctie.Fields("FunctionID") & " " & rstMedFunctie.Fields("Description")
rstMedFunction.MoveNext
Loop
I use this code to save the new record:
Dim sFunction,sID,sName As String
sID = txtMedewerkerID
sName = txtName
sFunction = cboFunction
rstEmployee.AddNew
rstEmployee!EmployeeID = sID
rstEmployee!name = sName
rstEmployee!FunctionID = sFunction(This line gives an error)
rstEmployee.Update
MY QUSTION:
When I select a function using the combobox, how in Gods name, do I save the functionID in the table tblEmployee???
If something isn't clear do ask!
Thanks in advance!
Sander