Want to pull up same record as Main Form from Subform

Gaccesses

Registered User.
Local time
Today, 13:39
Joined
Mar 13, 2012
Messages
40
Hi,

I have table. The table contains something like:

Car, Car Model, Car Color, Date of Arrival, Buyer's Date, Vin Number, LicPlate

I have a Main form with:
Car
Car Model
Car Color
Date of Arrival
Buyer's Date
Vin Number
LicPlate

I have a button on that main form named LicPlate_button:

The LicPlate_button populates a subform which automatically shows the vin number. I want the user to enter the License Plate number on this subform in the textbox : LicPlatetxbox, where the user will type a license plate number.

All of the above works like fine wine.

The problem I am running into is that when the user types the license number into the LicPlatetxbox that information does not return to the same record as the Main Form. The new entry continues to replace the previous entry on the very first record of the database and not the current record that the main form is on.

Just a clarification: the subform and the main form have information within the same table.

Pleae help!
 
If I understand you correctly you have One/Same Table for the Main and Sub Forms.

If so this would not be correct.

All you need is the Main Form for entering all the Data.

Perhaps you are wanting something different. If so please explain your circumstances better.
 
If it's the same table you only need the main form as RainLover also says...

If you want the option of entering more then 1 license plate then you take the LicPlate field out of your table and create a new table:

tblLicPlate
id (auto etc...)
idCar (because of course you also have an id in your car table!~)
LicPlate

Now this is the table you use for your subform and you do your parent/child link on id from the car table and idcar from the tblLicPlate..
 
Severin appears to have understood your question better than I did.

His advice is sound.
 
Thanks guys. However, I do want the LicPlate option to be accessed through a subform.

I have found that the command acNewRecord posted under LicPlate_Click() to open the LicPlate subform works like a charm, the only problem is making sure the entry for LicPlate actually posts to the record when I look at the table.

To be clear: I am able to open the subform to the same record that was created on the main form, but unable to make sure the data is saved to the table.

I am now looking around to find out how to make sure the new entry saves in the record. This is my only problem at the moment.
 
Please confirm that there is only one Table.
 
..you need to link the mainform with the subform via parent/child property on the subform. It will have to be with an id from the car table.
 
I don't agree with your approach but

You need to join the Sub to the Main via the Master and Child links located in the Properties of the Sub.

This is found in design view of the main. Open The properties box then click on the sub. Join Via the Primary Key.
 

Users who are viewing this thread

Back
Top Bottom