Is this Update Statement correct?

ravikode

New Member
Joined
Oct 10, 2003
Messages
27
Is this Update Statement correct?

Dim rstEqpCtrlUpd As Recordset
Dim dbsUps As DAO.Database
Set dbsUps = CurrentDb()
ToDate = Now()

Set rstEqpCtrlUpd = dbs.OpenRecordset("Update ControlReportDate " & " SET Date =([ToDate]) WHERE ReportName = 'EuipControlReport';")

dbsUps.Close
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi ravikode,

But adjusting your code to the following (changing its function in no way):
Code:
Dim rstEqpCtrlUpd As Recordset
Dim dbsUps As DAO.Database
Set dbsUps = CurrentDb()
ToDate = Now()

Dim updSQL As String
updSQL = "Update ControlReportDate " & " SET Date =([ToDate]) WHERE ReportName = 'EuipControlReport';"

Set rstEqpCtrlUpd = dbs.OpenRecordset(updSQL)

dbsUps.Close

I was able to determine you're using this for your update SQL:
Update ControlReportDate SET Date =([ToDate]) WHERE ReportName = 'EuipControlReport';

There are 2 spaces between ControlReportDate (even though the post shows one) and SET for starters, I don't have your db so its hard to tell much more, looks like 'EuipControlReport' might be spelled wrong, not sure.

But by assigning your update SQl to a string variable, you can test it in a query builder and try to isolate what's going on.

Hope this helps,
 
Upvote 0

Forum statistics

Threads
1,221,586
Messages
6,160,646
Members
451,661
Latest member
hamdan17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top