furnitureheaven
Registered User.
- Local time
- Today, 14:43
- Joined
- Aug 5, 2008
- Messages
- 36
Hi,
I am writing a code in VBA, but receive a error No 3464 (data type mismatch in criteria expression)
I have a table with 2 columns (Ftype and FRefNo) and I also have a form with a Combo Box (Combo8) and a Text box (frmRefNo).
I want, when user select value in Combo box (combo8) it should bring a matching RefNo from table and show into the text box (frmRefNo) on the form, and update with plus 1 in the FRefNo.
I have write a code in Combo Box Value Change Event.
My code is here
I am writing a code in VBA, but receive a error No 3464 (data type mismatch in criteria expression)
I have a table with 2 columns (Ftype and FRefNo) and I also have a form with a Combo Box (Combo8) and a Text box (frmRefNo).
I want, when user select value in Combo box (combo8) it should bring a matching RefNo from table and show into the text box (frmRefNo) on the form, and update with plus 1 in the FRefNo.
I have write a code in Combo Box Value Change Event.
My code is here
Code:
Private Sub Combo8_Change()
frmRefNo.SetFocus
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT FRefNo FROM LegLook Where (((Ftype)= '" & [Forms]![LegFile].[Combo8] & "'));")
Dim SQLtext As String
SQLtext = rs("FRefNO").Value
frmRefNo = SQLtext
rs.Close
Set rs = Nothing
DoCmd.RunSQL "UPDATE LegLook SET LegLook.FRefNo = LegLook.FRefNo+1 WHERE (((LegLook.Ftype)=&Forms!LegFile!Me.Combo8));"
End Sub