I have a basic form that is capturing a few fields. I need to write both values to the table which are based on the value of the corresponding comboboxes.
For example, when the user selects a particular Manager from the combobox (cboManager), I need to write the corresponding TeamID and Manager for that selection to my Problem_Record tbl.
tbl=Team has TeamID and Manager which are also fields in my Problem_Record tbl.
column count 2
column width 0.5";2";
control Source = Manager
Rowsource = SELECT Team.TeamID, Team.Manager FROM Team ORDER BY Team.Manager;
Form is using Problem_Record as Record Source.
How do I write the modify the code to capture both values for the Problem_Record tbl.
Code:
Private Sub cmdAddRecord_Click()
Dim R As Recordset
Set R = CurrentDb.OpenRecordset("SELECT * FROM [Problem_Record]")
R.AddNew
R![cboManager] = Me.Manager.Value 'Also need to capture the TeamId
R![cboCOD] = Me.COD.Value
R![cboFiscal_Year] = Me.Fiscal_Year.Value
R![cboQuarter] = Me.Quarter.Value
R![txtDate_Opened] = Me.Date_Opened.Value
R![txtContract_Number] = Me.Contract_Number.Value
R![cboCategory] = Me.Category.Value ' Also need to capture the CategoryID
R![cboProblem] = Me.Problem.Value 'Also need to capture the ProblemID
R![cboStaff] = Me.Staff.Value ' Also need to capture the StaffID
R![txtDescription] = Me.Description.Value
R.Update
R.Close
Set R = Nothing
'DoCmd.Close
End Sub
Just learning to use VBA and could use a little help!
TIA!