View Full Version : Help please! Update issue with sql statement


Bigmo2u
05-14-2008, 12:09 PM
I have a table that needs to be updated after it is imported. It keeps asking me for a perameter. Here is what I have.


Dim uSDN As String
Dim aStatus As String

aStatus = "A"

uSDN = "UPDATE tblSDN Set tblSDN.Status = aStatus WHERE tblSDN.Status Is Null"

DoCmd.RunSQL uSDN

I went as far as assigning the variable because it keeps asking for a perameter.

I know it is something simple and I am just missing it. End of the day and I am losing my mind.

I messed around with the Null issue, but that is not throughing me any errors right now.

Thanks for you help in advance.

georgedwilkinson
05-14-2008, 12:18 PM
I have a table that needs to be updated after it is imported. It keeps asking me for a perameter. Here is what I have.


Dim uSDN As String
Dim aStatus As String

aStatus = "A"

uSDN = "UPDATE tblSDN Set tblSDN.Status = aStatus WHERE tblSDN.Status Is Null"

DoCmd.RunSQL uSDN



Try this:

Dim uSDN As String
Dim aStatus As String

aStatus = "A"

uSDN = "UPDATE tblSDN Set tblSDN.Status = '" & aStatus & "' WHERE tblSDN.Status Is Null"

DoCmd.RunSQL uSDN

Bigmo2u
05-15-2008, 05:30 AM
georgedwilkinson - Thank you so much. '" & aStatus & "' setup gets me everytime, just don't understand how that works or why it has to be there. other times it is " & aStatus. just confusing to me.

namliam
05-15-2008, 05:32 AM
'" & aStatus & "' is for text fields
" & aStatus is for number fields
#" & aStatus & "# is for date fields.

Bigmo2u
05-15-2008, 06:43 AM
namliam - Thank you so much for clearing that up for me. I will put that in my notes.