ScottF
Sep 4th, 1999, 06:31 PM
I made a database in Access with ID, Firstname, Lastname , and StartDate . I want to SQL the database by ID and Startdate where Startdate are between two give dates by user. The user places the ID and two dates in to textbox on a form then click a button to start the code of the SQL. When I run the SQL it debug ok but it will skip the Do Until because dbs.EOF = true. I try change it to dbs.BOF . I try try placing dbs.MoveFirst. still does not work. It will show all the records on the table in the MSFlexgrid no mater what date or ID.
‘txt Start is the first texr5box the user enter the Start Date
‘ txtEnd is the textbox the user enter the end date
‘ txtId is the textbox that the user enter the Member ID number
Dim last as String
Dim db as Database
dim dbs as Recordset
last = txtID
strstartdate = "#" & txtStart & "#"
strendate = "#" & txtEnd & "#"
SQL = "select * FROM " & "Time1 where id = '" & LAST & "' and startdate between " & strstartdate & " and " & strendate & " ;"
Set db = OpenDatabase(Form1.Text1)
Set dbs = db.OpenRecordset(SQL)
Do Until dbs.EOF
Data1.Refresh
Data1.RecordSource = SQL
dbs.MoveNext
Loop
‘txt Start is the first texr5box the user enter the Start Date
‘ txtEnd is the textbox the user enter the end date
‘ txtId is the textbox that the user enter the Member ID number
Dim last as String
Dim db as Database
dim dbs as Recordset
last = txtID
strstartdate = "#" & txtStart & "#"
strendate = "#" & txtEnd & "#"
SQL = "select * FROM " & "Time1 where id = '" & LAST & "' and startdate between " & strstartdate & " and " & strendate & " ;"
Set db = OpenDatabase(Form1.Text1)
Set dbs = db.OpenRecordset(SQL)
Do Until dbs.EOF
Data1.Refresh
Data1.RecordSource = SQL
dbs.MoveNext
Loop