help!! combo box keeps getting error

rsbutterfly16

Registered User.
Local time
Today, 11:19
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
 
You could try RS.Movefirst - (you could also check there is a first before attempting this) - then


Me.LOC_Number = rs("[LOC_Number]")
 
I am not sure if i am doing it correctly , but i tried this :

rs.movefirst
Me.LOC_Number = rs("[LOC_Number]")

same errror...


also i tried this...


Set rs = CurrentDb.OpenRecordset(mysql1)

rs.FindFirst "[LOC_Number] = " & str(Nz(Me![LOC_Number], 0))
Me.LOC_Number = rs("[LOC_Number]")

get same error.
 
please.... error keeps happening

I am sending you the DB to see if you can Please hELP .... when you go to forms is the one named Change of status, the error happens after you change the FEC number or the contract numbers a couple of times... basically this form is for the user to be able only to edit the status(by clicking on the change status command button) then the status text box changes from active to inactive that is bound to the LOC table. All the controls are supposed to refreshed with new information when a user clicks on a different FEC number or contract number, etc.

for some reason also my save button is not working either... this is due today.. :eek:
 

Attachments

Users who are viewing this thread

Back
Top Bottom