Hi,
im making a form which calculates the total of a till at the end of the day. Once this is saved i enter it in a database called 'tblEndofDayTotal'.
What i want to do is:
Ive got a button which links to this form.
So when the button is pressed, I want it to check the tblEndofdayTotal table and compare the date with todays current date. If this matches I want the fields to auto populate with the data of the matched field.
If it doesnt, I want it to leave the fields empty.
In my tblEndofDayTotal I have the following fields:
Date = Date/Time
DateTotal = Currency
TillTotal = Currency
Difference = Currency
This is what ive tried
This code is not workin and its not matching the dates in the table.
How can i do this?
Thanks.
im making a form which calculates the total of a till at the end of the day. Once this is saved i enter it in a database called 'tblEndofDayTotal'.
What i want to do is:
Ive got a button which links to this form.
So when the button is pressed, I want it to check the tblEndofdayTotal table and compare the date with todays current date. If this matches I want the fields to auto populate with the data of the matched field.
If it doesnt, I want it to leave the fields empty.
In my tblEndofDayTotal I have the following fields:
Date = Date/Time
DateTotal = Currency
TillTotal = Currency
Difference = Currency
This is what ive tried
Code:
Set saveTotal = db.OpenRecordset("SELECT * FROM tblEndofDayTotal WHERE Date = " & Date)
If saveTotal.RecordCount = 0 Then
pre-fill all txt boxes
Else
Leave empty
End If
This code is not workin and its not matching the dates in the table.
How can i do this?
Thanks.