daily append

TallMan

Registered User.
Local time
Today, 10:30
Joined
Dec 5, 2008
Messages
239
I am trying to create a click button on a form that would allow me to run an append query based on the day.

Because today is Friday and I am trying to test this out I am using this code.(The base date is a text box which displays todays date and Daily is the query that I am trying to run.

Private Sub Command43_Click()
If "base_date" = "6" Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "Daily"
End If

PLease let me know if you need more information.
Any suggestions???? Thanks Guys!!!
 
"Base_date" is just a Date() expression on the form.
 
If base_date is a date then it will never equal a text "6"

You could use

If Weekday([base_date]) = 6 Then


or

If Format([base_date],"dddd") = "Friday" Then


Also, if you use DoCmd.SetWarnings False then make sure to add DoCmd.SetWarnings True afterwards (or you will find yourself without warnings at all, including the save warnings). Also, make sure you have an error handler with DoCmd.SetWarnings True as the first line in it.
 

Users who are viewing this thread

Back
Top Bottom