By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,865 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,865 IT Pros & Developers. It's quick & easy.

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

imrosie
100+
P: 222
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
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
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
100+
P: 222
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
Expert 2.5K+
P: 3,532
What's the code behind the cmd button that opens the 'beginorder' form?
Jul 24 '07 #4

imrosie
100+
P: 222
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

Post your reply

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