473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to clone a command button action

I want to clone an action button in an Access 97 form, but have it update multiple fields in related records. The current button only updates one field.

The code I am looking at and copying/pasting to my new button is:

Expand|Select|Wrap|Line Numbers
  1.     ' update the follow-up date in the remaining members of this debtor group
  2.     Dim strSQL As String
  3.     strSQL = "update DEBTORS set [UNTL] = '" & Me.UNTL & _
  4.             "' where [DCODE] = '" & Me.DCODE & "';"
  5.     DoCmd.SetWarnings False
  6.     DoCmd.RunSQL strSQL
The UNTL field is updated in that action, but I want to update multiple fields, those being L4, PHONE, BLDG, STREET,CITY,ZIP,AREA

How do I update multiple fields by that command button action?
Oct 11 '10 #1
3 1764
nico5038
3,080 Expert 2GB
Use an "expanded" SET command like:

Expand|Select|Wrap|Line Numbers
  1. UPDATE tblA SET A = 123, B = 456, C = "test"
  2. WHERE A <> 234
  3.  
Nic;o)
Oct 11 '10 #2
I finally found the proper syntax:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "update DEBTORS set [UNTL] = '" & Me.UNTL & _
  2. "', [AREA] = '" & Me.AREA & "' [L4] = '" & Me.L4 & "', [PHONE] = '" & Me.PHONE & "', [BLDG] = '" & Me.BLDG & "', [STREET] = '" & Me.STREET & "', [CITY] = '" & Me.CITY & "', [ZIP] = '" & Me.ZIP & "' WHERE [DCODE] = '" & Me.DCODE & "';"
Just some comma placement between the fields to be updated! I knew it was simple.

Again, this was Access 97
Oct 12 '10 #3
nico5038
3,080 Expert 2GB
When you know, it's always simple :-)

Well done, stringing this much as always a daunting task.

Success with your application !

Nic;o)
Oct 12 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Samantha Smit | last post by:
Hi, I am trying to create a simple asp page that has one command button that updates a database. The URL of the page is like this: http://MyServer.com/Update.asp?UserName=Tom My asp code is...
6
by: deko | last post by:
I have a several forms that accept user input in a textbox and then take some action based on that input after a command button is clicked. Is it possible issue the command when the user presses...
2
by: Colin | last post by:
I have a main form with a command button on it that when clicked, opens a subform displaying records that relate to the main form. I would like to disable the command button if the corresponding...
2
by: marmono | last post by:
hello, I am an extreme novice and was wondering if anyone has an answer for me I cant seem to find in any of my books. what I want to do: -Allow the user to Name and create his/her own command...
5
by: vandanavai | last post by:
Hello everybody, I have recently joined forum and this is my first post. I am trying to learn access. I could develope simple form with 3 text boxes and one command button on it. When command...
24
Dököll
by: Dököll | last post by:
Jumped for joy last night after learning, indeed, the command button wizard can be switched on or off. Well this occured here, with my Access 2000...an attempt to redo at work failed. Here's the...
2
by: zillou32 | last post by:
Hi guy, my question is as follows, am currently working on an excel sheet and need to add a vb command button. the action of this button is to to sent the sheet by mail (outlook). the command...
16
by: Steve | last post by:
I am working on a database that has a main menu, many sub-menus and some sub-sub-menus. They are all forms that have numerous command buttons on them to open forms and reports in the database. The...
5
by: scottbouley | last post by:
I'm trying to create a command button that will perform one action on the first click and another action on the second click. I tried to accomplish it by using a variable but I think the variable is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.