|
-
Feb 5th, 2002, 06:27 AM
#1
Thread Starter
Junior Member
Using SQL commands with Access
Does anyone have any idea why the code below works on about twenty machines but not one of them. They are using Windows 98. Date1 and Date2 are fields in the access database and there are matches for the search I am doing so the recordset should not be empty.
Thanks.
Dim db1 As DAO.Database
Dim rs1 As DAO.Recordset
Dim myws As Workspace
Dim sqlstr As String
Dim TodaysDate As String
TodaysDate = Format(Date, "yyyymmdd")
sqlstr = "select * from TestTable where val(Date1) <= val(" + TodaysDate + ") and val(Date2) >= val(" + TodaysDate + ") order by IntNo"
Set myws = DBEngine.Workspaces(0)
Set db1 = myws.OpenDatabase("C:\Test.mdb")
Set rs1 = db1.OpenRecordset(sqlstr)
If rs1.BOF And rs1.EOF Then
MsgBox "It doesn't work"
Else
MsgBox "It works"
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|