Keep Name for new form (1 Viewer)

A17BPG

New member
Local time
Today, 02:29
Joined
Mar 30, 2018
Messages
23
Also, if you are setting a controls value with code, make sure that controls Default Value is blank. If it is not, that will also cause an error.

You missed the point of my question completely I'm afraid.
I'm not asking about the Forms record source, just the individual control which is the value you are trying to change.

So take a screenshot of the CustomerID control properties on the order form.
Preferably with its Control Source showing as per my screenshot.
Hi Minty thanks for keeping in contact as requested am attaching a screenshot of the Control Property on the Order Input & the Customer Input Forms the Control Properties are Identical,
 

Attachments

  • Screenshot Customer and Order Details Input Forms.png
    Screenshot Customer and Order Details Input Forms.png
    14.4 KB · Views: 69
  • Screenshot Order Details Screenshot.png
    Screenshot Order Details Screenshot.png
    19.6 KB · Views: 72

A17BPG

New member
Local time
Today, 02:29
Joined
Mar 30, 2018
Messages
23
You are confusing the form properties with the individual control properties on the form.
  1. Open the form in design mode
  2. Find the textbox control named CustomerID and select it
  3. In the CustomerID properties window, look for the Default Value property
  4. Make sure it is blank
Further, it sounds like you are using ACCESS like a spreadsheet by passing values between forms. Do you have Primary Keys and Foreign Keys established so that relationships can exist between your tables? Have you established these relationships? Because if you have not, then you need to start over with your design and get that properly established first.

That said, if both forms are open and assuming:
  1. The customer input form has the correct customer record selected
  2. The Orders Input form has a new record selected AND is the active form
  3. Then you can pass the CustomerID FROM the customer input form TO the Order input form with:
Me.CustomerID = Forms![Form Orders Input]![CustomerID]
The 'Me' refers to the active order input form. You have it backwards in your original code.
And this is assuming the CustomerID textbox on the customer input form AND the CustomerID textbox on the order input form BOTH are named CustomerID.

Also, remove the DoCmd.RunCommand acCmdSaveRecord. It is useless.
Hi Larry
Thanks for assistance have done as suggested and remove the DoCmd.RunCommand acCmdSaveRecord. line of code.

i have tried the "Me.CustomerID = Forms![Form Orders Input]![CustomerID]" code but it did not work, but I have attached a couple of screenshots.
Again thanks for your interest.
 

Attachments

  • Screenshot Customer and Order Details Input Forms.png
    Screenshot Customer and Order Details Input Forms.png
    14.4 KB · Views: 71
  • Screenshot Relationships.png
    Screenshot Relationships.png
    27.3 KB · Views: 67

Minty

AWF VIP
Local time
Today, 10:29
Joined
Jul 26, 2013
Messages
10,368
Okay - Your recordsource for the Orders Form is set to the customer table. This is incorrect.

Your recordsource for the orders form should be the Orders table, and the customer ID will be a foriegn key field in that table. This matches your relationship diagram.

If the above statement means nothing to you then post back.
Change the recordsource in the orders form and I suspect it will all work.
 

A17BPG

New member
Local time
Today, 02:29
Joined
Mar 30, 2018
Messages
23
Okay - Your recordsource for the Orders Form is set to the customer table. This is incorrect.

Your recordsource for the orders form should be the Orders table, and the customer ID will be a foriegn key field in that table. This matches your relationship diagram.

If the above statement means nothing to you then post back.
Change the recordsource in the orders form and I suspect it will all work.
Hi Minty " IT WORKS" Many thanks to everyone for their input
 

Users who are viewing this thread

Top Bottom