Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update query

Status
Not open for further replies.

mikeba1

Programmer
Jan 2, 2005
235
GB
update problem
access 10 running as 2007 mdb


attached sql view of update query

UPDATE DiveRecords SET DiveRecords.Patient1Name = [Forms]![updatechangesdives]![nametouse]
WHERE (((DiveRecords.Patient1Name)=[Forms]![updatechangesdives]![orgname]));

I am trying to change the field I am searching

form updatechangesdives has data in both fields

resultant table diverecords not updated
 
I would guess your actual code looks something like this:

Code:
strSQL = "UPDATE DiveRecords " & _
" SET Patient1Name = [Forms]![updatechangesdives]![nametouse] " & _
" WHERE (((Patient1Name)=[Forms]![updatechangesdives]![orgname]));"

If so, what do you get in the Immediate Window when you do this:

Code:
Debug.Print strSQL

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
HOW ABOUT

Code:
UPDATE DiveRecords SET DiveRecords.Patient1Name = [COLOR=#EF2929][i][b]'[/b][/i][/color][Forms]![updatechangesdives]![nametouse][COLOR=#EF2929][i][b]'[/b][/i][/color]
WHERE (((DiveRecords.Patient1Name)= [COLOR=#EF2929][i][b]'[/b][/i][/color][Forms]![updatechangesdives]![orgname][COLOR=#EF2929][i][b]'[/b][/i][/color]));
 
Thanks guys
Problem resolved
My finger problem and tired grey cells
 
Would you share your solution with others?
So if anybody has the same problem they can find the cure here.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
The form I was using was copied from another db and the field names were slightly different than used in the sql, only slightly different but enough.
My problem was assuming something without proper investigation.
You guys sending your sql examples made me look further. Thanks

 
I would assume you have [tt]Option Explicit[/tt] at the top of your code, and Error Handlers in your events. This way your first run would tell you what's wrong.
But - I guess - my assumptions are wrong :-(

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top