Update query date range

Coldsteel

Registered User.
Local time
Today, 05:17
Joined
Feb 23, 2009
Messages
73
Hello all,

I have a table called table 1. I am trying to use a update query to update my data within a certain date range. Is it possible to build a form to send the date range to the query and if so are there any examples which I may look to learn from.


Thanks
 
It should be very simple.

1. Create a form with the two text boxes for the date range (txtBeginDate, txtEndDate)
2. Depends on what you want to update.

Code:
Dim sSQL as String

sSQL = ""
sSQL = sSQL & "Update Table_Name SET "

sSQL = sSQL & "FieldName1 = 'text', "
sSQL = sSQL & "FieldName2 = 'text', "
sSQL = sSQL & "FieldName3 = 'Text' "
'etc.....
sSQL = sSQL & "Where CreateDate >= #" & txtBeginDate & "# "
sSQL = sSQL & "AND CreateDate <= #" & txtEndDate & "# "

Currentdb.Execute sSQL
 
Thanks for the help. I built a Form and a Sub-form to tryout the code and listed a screen shot of it. I am having poblems getting the data from the subform to update all the Wigets and Cogs with in the date range with the new payout. Any pointers on what I might be doing wrong thanks

Here is a screen shot of what I am trying to do
 

Attachments

If the subform data are loaded based on a date range, after you updated the data, you will need to refresh the subform to get the updated data.

Sorry, i haven't look at this thread for a while.
 

Users who are viewing this thread

Back
Top Bottom