Run Sql

D

DZ

I am updating records from an update form.

Unbound Textboxes in the form header allow the user to enter the values
that they want to update specific fields to. Each Unbound Textbox will
update a specific field in the underlying record source.

The user clicks a button to update the records based on a filter the user
applies.

I used the following by mistake. I used ' ' to enclose the values.
The first statement is using numeric data. The unbound textbox is formatted
for numbers and the Total field is a number field data type.
The second statement is using date data. The unbound textbox is formatted
for date and the effDate field is a date field data type.
After I ran it, I realized that I should have not used ' ' to enclose the
number value and I should have used ## to enclose the date value.

The strange thing is it works anyway. the records were updated without any
errors and the date and numbers (Currency) appear just fine in the updated
records.

Is there problems with this or should I just leave the SQL as it is? Could
this cause a problem in the updated records?

Thanks for any thoughts on this







DoCmd.RunSQL "UPDATE PolicyInformation SET [Total] = '" & Me.txtTotal & "'"
DoCmd.RunSQL "UPDATE PolicyInformation SET [effDate] = '" & Me.txt[effDate]
& "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top