473,387 Members | 1,492 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,387 software developers and data experts.

fHelp please-----How to save new data through a command button

imrosie
222 100+
Help please,

I have a customer information form (in an Order app). The old customer information is populated into the controls from row query. However, when I attempt to save new information typed into the controls.....it doesn't work. I have a command button for this event.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAdd_Click()
  2.  DoCmd.RunCommand acCmdSaveRecord
  3. End Sub
  4.  
Instead of saving the customers' new info, it's saves a whole new record for the customer....Help Help...what am I doing wrong....anyone
I'm a newbie,,,,,what am I missing here? thanks
Jul 24 '07 #1
4 1903
missinglinq
3,532 Expert 2GB
How does it not work? Does it simply do nothing or does it throw an error? How are you determining that it's not saving the data?
Is the Form's AllowEdits Property set to Yes?
Is you Form based on a Query or a Table?
If based on a Query, can you run the Query and edit the information in it?

Linq ;0)>
Jul 24 '07 #2
imrosie
222 100+
How does it not work? Does it simply do nothing or does it throw an error? How are you determining that it's not saving the data?
Is the Form's AllowEdits Property set to Yes?
Is you Form based on a Query or a Table?
If based on a Query, can you run the Query and edit the information in it?

Linq ;0)>
Hi linq,

Yes the AllowEdits is set to Yes
Yes, my form is based on a query
Yes, I can run the query an edit the info...

What happens is this. I have a search form ,to locate a customer from the Cust table. Once customer is located, it populates their info into all the controls (address, phone, city, etc plus their account number (from an autonum, but that's another problem)....
From there I have a cmd button that opens the 'beginorder' form and passes cust data from search form to the 'beginorder' form
Now when I add the products (from the subform on the 'beginorder' form) and click the save button, a new customer is saved with a new autonumber. This is annoying and I"m trying to figure out how this is happening.

thanks
Rosie
Jul 24 '07 #3
missinglinq
3,532 Expert 2GB
What's the code behind the cmd button that opens the 'beginorder' form?
Jul 24 '07 #4
imrosie
222 100+
What's the code behind the cmd button that opens the 'beginorder' form?
Hello missinglinq,

the code is as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub BeginOrder_Click()
  2. DoCmd.OpenForm "Add an Order and Details"
  3. 'The event to open the Order form with some controls filled in
  4. Forms![Add an Order and Details]![thefullname].Value = Forms![Search a Customer]![FullName]
  5. Forms![Add an Order and Details]![TheCompany].Value = Forms![Search a Customer]![compname]
  6. Forms![Add an Order and Details]![custacct].Value = Forms![Search a Customer]![custaccts]
  7. Forms![Add an Order and Details]![ShipAddress].Value = Forms![Search a Customer]![ShipAddress]
  8. Forms![Add an Order and Details]![thecountry].Value = Forms![Search a Customer]![acountry]
  9. Forms![Add an Order and Details]![ShipCity].Value = Forms![Search a Customer]![ShipCity]
  10. Forms![Add an Order and Details]![BillingAddress].Value = Forms![Search a Customer]![BillingAddress]
  11. Forms![Add an Order and Details]![ShipStateOrProvince].Value = Forms![Search a Customer]![ShipStateOrProvince]
  12. Forms![Add an Order and Details]![ShipZIPCode].Value = Forms![Search a Customer]![ShipZIPCode]
  13. DoCmd.Close acForm, "Search a Customer", acSaveNo
  14.  
thanks for any suggestiions
Rosie
Jul 25 '07 #5

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

Similar topics

8
by: Colleyville Alan | last post by:
I have been working on an Access app that takes info from a file and writes it to a spreadsheet on a form, simultaneously saving the spreadsheet to Excel. I got the idea that the same concept...
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: Rebecca | last post by:
I have a dynamically created command button on a .net page that adds 1 row to a sql server table when clicked. The page_load event load rows from that table for the user to view, but for some reason...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
7
by: rinku123 | last post by:
suppose in vb form are more then one textbox which is contain data and i want i click command button it save in msword file and it can replace many times suppose just like we make report). i have...
20
by: Amanduh | last post by:
Hi, I'm kind of being forced to dive into the whole Access world at my work, and I haven't done coding in years. I've basically created the whole database I want, even made cascading comboboxes. ...
5
by: pld60 | last post by:
I have a bound form to a table. I have a command button to save when clicked that uses the following code. Private Sub Commandsaverecord_Click() On Error GoTo Err_Commandsaverecord_Click ...
4
by: Ezzz | last post by:
I have customised a form to display my own error messages using:- Private Sub Form_Error(DataErr As Integer, Response As Integer) ' If an error occurs because of duplicate data in a required...
4
beacon
by: beacon | last post by:
Hi everybody, I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.