Set id from one table to other

Zelo

Registered User.
Local time
Today, 16:37
Joined
Mar 9, 2007
Messages
35
Hello. I'm first time here.
I have a problem. Two forms - the one is Orders with field "id", other - Works with fiels "order_id". I form Orders i can record company name an other information. In this form exist ListBox, in which i can see information about company. In this ListBox i can choose different company and on this company double click must open form Works with works, which depends only for this company. For one company could be a lot of works. So, i can't set "id" from orders to "order_id" that i can see all works of choosed company.
How to make that??? :confused: :confused:

Sorry of my English, it's not native language for me.
 
First, so that you can work at a comfortable pace, I'm going to suggest that you search this forum for the topic "Cascading Combo Boxes" - which will show you how to make a selection drop-down structure that depends on some other element of a form. I think that is what you are requesting.
 
No, no, no. I want automatically set "id" number from Orders, to "order_id" from Works, when i make double_click in listbox on needed company. And when form Works opening, the field "order_id" automatically must have "id" number of "Order".
 
I think you are after continous forms ...???
any way look at the attached
this puts an id number in to a another table (and allows multiples of) so you could end up with customer 1 having 20 orders

look at the attached for idea's
This is not the tidest of coding or layout

but shows 1 way of doing 1 records linked to multiple orders or mulitples of someother kind
 

Attachments

I attached DB for example. Forms are in Lithuanian, but Orders and Works I tried to translate in English. All ow Works i must see in ListBox. And this DB using Linked tables
 

Attachments

OK, you have a one to many relationship between Orders and Works. The best way to manage this is in a form/subform setup. The parent/child like will be between ID in Orders and order_ID in Works. When you display an order record in the main form, the subform will show the related works. If you add a new record in Works, it will automatically be populated with the ID from Orders.

It is a good idea to use the same name for these fields in the parent and child table. So you would change the field in Orders from ID to order_ID. If you do this, then the subform wizard will recognise these as matching fields and set them to parent/child.
 
ok, i made this, but it not working. i don't have the same order_id in Orders and Works. I don't have order_id in Works at all.
 
Did you use the subform wizard to make a new form/subform relationship?
 
Yes, I used subform wizard to make a new form/subform relationship

hmmm, strange, but this your attached files like attached files in my post
 
Your Order form shows Works in a list box. Mine shows Works as records in a bound subform, that's the difference.
 

Users who are viewing this thread

Back
Top Bottom