Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 19th, 2007, 12:27 PM
Authorized User
 
Join Date: Aug 2006
Location: Hoffman Estates, IL, USA.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update Query Question

Hello:
  I am working on an update query and want to know if there is a way to have it do what I want. Okay, it's a simple update query really. Doing it by hand is easy, I'd just rather make it so I can have anyone do it without entering the query.

Synopsis: I need to update my ISBN's, but they are used in two different tables. So, I can manually run an update query where I have both tables and type in the old ISBN and the New ISBN for both. What I'd like to do is have the query ask what is the old ISBN and what is the new ISBN and have it change it in both tables.

Any thoughts?

Best Regards,
Arholly

Reply With Quote
  #2 (permalink)  
Old January 19th, 2007, 12:34 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

I'd throw together a form with two text boxes, old & new, and an update button. On the OnClick event, I would add something like the following:

[Code]
if txtOld = "" OR txtNew="" then
   msgbox "Please make sure you have both and old and a new ISBN entered."
   exit sub
end if

strSQL = "UPDATE Table1 SET ISBN=" & chr(34) & txtNew & chr(34) & " WHERE ISBN=" & chr(34) & txtOld & chr(34)

docmd.setwarnings false
docmd.runsql strSQL

strSQL = "UPDATE Table2 SET ISBN=" & chr(34) & txtNew & chr(34) & " WHERE ISBN=" & chr(34) & txtOld & chr(34)

docmd.runsql strSQL
docmd.setwarnings true
[Code]

Hope that helps... Let me know if you need a hand putting it in place.

Mike




Mike
EchoVue.com
Reply With Quote
  #3 (permalink)  
Old January 19th, 2007, 01:28 PM
Authorized User
 
Join Date: Aug 2006
Location: Hoffman Estates, IL, USA.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Worked perfectly. Thanks.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update inner join question Graham SQL Language 6 January 22nd, 2011 11:55 AM
I solved insert query.now see this Update Query. amit_mande@yahoo.com VB.NET 2002/2003 Basics 2 September 21st, 2006 12:48 AM
Recordset Update question smarks Classic ASP Databases 2 March 14th, 2005 03:57 AM
SQL Update question U.N.C.L.E. SQL Server 2000 1 December 9th, 2004 08:47 PM
DataGrid Update Question shahchi1 ASP.NET 1.0 and 1.1 Basics 2 June 11th, 2004 10:40 AM



All times are GMT -4. The time now is 02:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.