rsbutterfly16
Registered User.
- Local time
- Today, 07:52
- Joined
- Jun 5, 2006
- Messages
- 77
hi guys, i was wondering if you can help me, i have a text box and a combo box that needs to changed every time the user clicks on a contract in my contract combo box... but i keep getting this error and it goes to the end of the code and it says the value you entered isn't valid for this field....
Private Sub cboPMContract_Click()
Dim mysql1 As String
Dim mysql2 As String
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
mysql1 = "SELECT LOC.LOC_Number FROM LOC WHERE (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
mysql2 = "SELECT LOC.Status FROM LOC WHERE (LOC.LOC_Number='" & LOC_Number.Value & "')and (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
Set rs = CurrentDb.OpenRecordset(mysql1)
Set rs2 = CurrentDb.OpenRecordset(mysql2)
'it points here******
Me.LOC_Number = rs("[LOC_Number]")
Me.cboStatus.Value = rs2("[Status]")
End Sub
Private Sub cboPMContract_Click()
Dim mysql1 As String
Dim mysql2 As String
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
mysql1 = "SELECT LOC.LOC_Number FROM LOC WHERE (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
mysql2 = "SELECT LOC.Status FROM LOC WHERE (LOC.LOC_Number='" & LOC_Number.Value & "')and (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
Set rs = CurrentDb.OpenRecordset(mysql1)
Set rs2 = CurrentDb.OpenRecordset(mysql2)
'it points here******
Me.LOC_Number = rs("[LOC_Number]")
Me.cboStatus.Value = rs2("[Status]")
End Sub