Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Variables
Message
 
To
27/08/2001 15:56:27
General information
Forum:
Microsoft Office
Category:
Access
Miscellaneous
Thread ID:
00549592
Message ID:
00549619
Views:
15
This message has been marked as the solution to the initial question of the thread.
Try this
1.     Dim R As Recordset
2.     Dim SqlText As String

3.     SqlText = "Select * From Product Where trknum=" & me.trknum2 & ";"
4.     If CurrentDb.OpenRecordset(SqlText).RecordCount > 0 Then
5.          MsgBox "Record Exists"
6.     Else
7.          MsgBox "Record Not Found"
8.     End If
HTH, Igor

>The following code works on a form that I created. However, I want to replace the '5' in line 3 with the value from a textbox on the form. The name of the textbox is trknum2. When I try to replace '5' with form![trknum2], or if I type:
>
>Dim mvar as Long
>mvar = form![trknum2}.value
>
>and replace the '5' with mvar
>
> I get an error message saying it's looking for another argument. I am assuming that this can be done and that the error has something to do with trknum being dimmed as Long but I am not sure. I would really appreciate any help.
>
>
1.     Dim R As Recordset
>2.     Dim SqlText As String
>
>3.     SqlText = "Select * From Product Where trknum = 5;"
>4.     If CurrentDb.OpenRecordset(SqlText).RecordCount Then
>5.          MsgBox "Record Exists"
>6.     Else
>7.          MsgBox "Record Not Found"
>8.     End If
Igor Gelin
Database Developer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform