Adding Data To Subform With Same ID

vagues0ul

Registered User.
Local time
Today, 12:36
Joined
Sep 13, 2018
Messages
103
i want to add record to a subform through another popup form but the id should remain same. I am attaching the db along with the post in which the agent and client tables are in relationship and i want to add client in the subform through a popup form. But when i fill the form and save it even after selecting the same agent. It creates a new agent id and saves the data in that id which is opposite of wha i am trying to achieve. any help on how to fix this will be highly appreciated.
 

Attachments

1: The Agent table store agent related data.
2: Passenger_Details table is storing passengers data that are related to specific agent
3: One agent can have many passengers but they need to be on same agent id (eg id 57 can have many passengers detail linked to it.)

that is the main scenario i am trying to have. If i enter any passenger detail on the subform present on AGENT form (in datasheet view) then it saves the data with same agent id. But if i try to add it through another popup form then it creates a new ID for the agent (which is not what i am trying to do).

i have tried using tempvariables macros and got Agent_Name on second form but unable to get the agent_id passed to that popup form. I hav attached the ammended file again with the db and deleted the tables that are creating confusion.
 

Attachments

The main problem here is that you've bound the combobox to the AgentId, it should be to the PassengerId.
 

Attachments

yes i did notice but can you explain why cliednt it is needed there instead of agent id ?:confused:
attachment.php

When you add a new passenger you are adding the data to the "Passenger_Details" table, (that should be obviously). The first field is "Passenger_ID", which you use to link the Agent and the Passenger together, therefore you need to put in the value of "AgentID".
If you instead bound the combobox to "AgentID", you're creating a new record in the "Agent" table, which you've observed.
One of the minor issues is your field names and how you're naming them, I think you're confusing you self, then "Passenger_ID" isn't actually a passenger id but an agent id. A real "Passenger_ID" is a number by which you can uniquely identify a passenger like a Passport number or a Uncle Gizmo mention an autonumber field in the "Passenger_Details" table.
 

Attachments

  • Passenger_ID1.jpg
    Passenger_ID1.jpg
    18 KB · Views: 183

Users who are viewing this thread

Back
Top Bottom