Search in a Form - Vb code (1 Viewer)

sundaram

Registered User.
Local time
Today, 23:18
Joined
May 28, 2009
Messages
36
Dim StrSql As String
*Dim lngCri As Long*
Dim X As String

X = rst.Fields("Sr#").Value

*lngCri* = InputBox("Enter the Serial NO", "Enter number/", "Question/")
If Len(*lngCri*) = 0 Then
MsgBox Prompt:="No Criteria Specified", Title:="Search tblEmp.MDB"
Exit Sub
End If
StrSql = "SlNo=*" & lngCri *



rst.FindFirst StrSql

If rst.NoMatch = False Then
Movefields
Else
MsgBox "Not Found."
rst.MoveFirst
End If

There is a error msg. RUNTIME ERROR '3077':
Syntax error (missing operator) in expression.

Please help me.

 

Poppa Smurf

Registered User.
Local time
Tomorrow, 05:18
Joined
Mar 21, 2008
Messages
448
Check the * used in your code.

In Access code the * is a mathematical operator and is used to multiply to values e.g. field1 * field2 means field1 is multiplied by field2.
 

Users who are viewing this thread

Top Bottom