Happy510
01-04-2001, 10:09 AM
Hello,
I have an Access 2000 database with three tables. One table with customer information a second table with employee information and a third table with incomming phone call information. When a phone call comes in, on my form the user enters in the call information such as call time and date, message, who took the call and who the call is for. The problem I am having is that on my form the user picks the employees name of who the call is for and who took the call from a combo box but I need to write the employees ID number ( primary key of employee table) instead of thier name to the table. can anyone help me? By the way I am using ado.
Here is my code:
Private Sub cmdOK_Click()
rsRecordsetCall.AddNew
'???rsRecordsetCall.Fields("Customer.FirstName").Value = cmbCallFor.DataMember
rsRecordsetCall.Fields("CallInDate").Value = dtpCallDate.Value
rsRecordsetCall.Fields("CallInTime").Value = dtpCallTime.Value
If txtMessage.Text = "" Then
MsgBox "Please Enter A Message"
Exit Sub
Else
rsRecordsetCall.Fields("CallInMessage").Value = txtMessage
End If
'Set up option button value
If OptSeverity1.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "1"
ElseIf OptSeverity2.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "2"
ElseIf OptSeverity3.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "3"
ElseIf OptSeverity4.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "4"
ElseIf OptSeverity5.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "5"
ElseIf OptSeverity1.Value = False And _
OptSeverity2.Value = False And _
OptSeverity3.Value = False And _
OptSeverity4.Value = False And _
OptSeverity5.Value = False Then
MsgBox "Please Select A Severity Level"
Exit Sub
End If
rsRecordsetCall.Update
'Clear bottom of form
txtMessage.Text = ""
OptSeverity1.Value = False
OptSeverity2.Value = False
OptSeverity3.Value = False
OptSeverity4.Value = False
OptSeverity5.Value = False
End Sub
I have an Access 2000 database with three tables. One table with customer information a second table with employee information and a third table with incomming phone call information. When a phone call comes in, on my form the user enters in the call information such as call time and date, message, who took the call and who the call is for. The problem I am having is that on my form the user picks the employees name of who the call is for and who took the call from a combo box but I need to write the employees ID number ( primary key of employee table) instead of thier name to the table. can anyone help me? By the way I am using ado.
Here is my code:
Private Sub cmdOK_Click()
rsRecordsetCall.AddNew
'???rsRecordsetCall.Fields("Customer.FirstName").Value = cmbCallFor.DataMember
rsRecordsetCall.Fields("CallInDate").Value = dtpCallDate.Value
rsRecordsetCall.Fields("CallInTime").Value = dtpCallTime.Value
If txtMessage.Text = "" Then
MsgBox "Please Enter A Message"
Exit Sub
Else
rsRecordsetCall.Fields("CallInMessage").Value = txtMessage
End If
'Set up option button value
If OptSeverity1.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "1"
ElseIf OptSeverity2.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "2"
ElseIf OptSeverity3.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "3"
ElseIf OptSeverity4.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "4"
ElseIf OptSeverity5.Value = True Then
rsRecordsetCall.Fields("CallSeverity").Value = "5"
ElseIf OptSeverity1.Value = False And _
OptSeverity2.Value = False And _
OptSeverity3.Value = False And _
OptSeverity4.Value = False And _
OptSeverity5.Value = False Then
MsgBox "Please Select A Severity Level"
Exit Sub
End If
rsRecordsetCall.Update
'Clear bottom of form
txtMessage.Text = ""
OptSeverity1.Value = False
OptSeverity2.Value = False
OptSeverity3.Value = False
OptSeverity4.Value = False
OptSeverity5.Value = False
End Sub