Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Variables
Message
From
27/08/2001 15:56:27
 
 
To
All
General information
Forum:
Microsoft Office
Category:
Access
Title:
Help with Variables
Miscellaneous
Thread ID:
00549592
Message ID:
00549592
Views:
39
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
Here's to alcohol...the cause of ... and solution to ... all of life's problems - - Homer J. Simpson
Next
Reply
Map
View

Click here to load this message in the networking platform