dbTalk Databases Forums  

Update Query Error!!!

comp.databases.ms-access comp.databases.ms-access


Discuss Update Query Error!!! in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael
 
Posts: n/a

Default Update Query Error!!! - 12-17-2004 , 09:37 AM






I am attempting to run this update query from code and I keep getting a
message that says "you are about to update "0" records". The query
does not update the table at all. These are linked tables in a back
end mdb. What am I doing wrong?? The code is as follows.....

Thanks for the help
Mike



Dim strsql As String
Dim BD As String
Dim ED As String

BD = Me.BDate
ED = Me.Edate

strsql = "UPDATE tblDateCarry SET tblDateCarry.Bdate = " & BD & ",
tblDateCarry.EDate = " & ED & ";"
DoCmd.RunSQL (strsql)


Reply With Quote
  #2  
Old   
pietlinden@hotmail.com
 
Posts: n/a

Default Re: Update Query Error!!! - 12-17-2004 , 10:26 AM







Michael wrote:
Quote:
I am attempting to run this update query from code and I keep getting
a
message that says "you are about to update "0" records". The query
does not update the table at all. These are linked tables in a back
end mdb. What am I doing wrong?? The code is as follows.....

Thanks for the help
Mike



Dim strsql As String
Dim BD As String
Dim ED As String

BD = Me.BDate
ED = Me.Edate

strsql = "UPDATE tblDateCarry SET tblDateCarry.Bdate = " & BD & ",
tblDateCarry.EDate = " & ED & ";"
DoCmd.RunSQL (strsql)
ED and BD should be defined as DATES not STRINGS. Are there any
records in your table? what happens if you turn the thing into a
select query? Does it return records?



Reply With Quote
  #3  
Old   
Eric Schittlipz
 
Posts: n/a

Default Re: Update Query Error!!! - 12-17-2004 , 11:01 AM




"Michael" <MUB (AT) verizon (DOT) net> wrote

Quote:
I am attempting to run this update query from code and I keep getting a
message that says "you are about to update "0" records". The query
does not update the table at all. These are linked tables in a back
end mdb. What am I doing wrong?? The code is as follows.....

Thanks for the help
Mike



Dim strsql As String
Dim BD As String
Dim ED As String

BD = Me.BDate
ED = Me.Edate

strsql = "UPDATE tblDateCarry SET tblDateCarry.Bdate = " & BD & ",
tblDateCarry.EDate = " & ED & ";"
DoCmd.RunSQL (strsql)

It might be a good idea to Debug.Print the strSQL instead of running it -
you might then see the problem in the string. You need to be careful with
dates and formatting them - but the following gives two possible examples to
do the same thing:

SET tblDateCarry.Bdate = '2004-06-23', tblDateCarry.EDate = '2004-07-25'

SET tblDateCarry.Bdate = #6/23/2004#, tblDateCarry.EDate = #7/25/2004#




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.