copying autonumber across tables (1 Viewer)

lloydmav

Registered User.
Local time
Today, 20:29
Joined
Nov 15, 2002
Messages
75
I'm not sure I've done this right but I got a load of tables all about a new company product. There is a Product Master Table where the new Product ID is created (Autonumber) and then there are loads of tables linked to this with the foriegn key (Product ID). Each of these tables is a set of data about the new product. These have been set up as Long Integer's in the hope that when a new Product Master record is created the autonumber would be carried across into these tables. Unfortunately this is happening, can anyone tell me what I'm doing anything wrong or whether there is anything else that I need to do to set this up? The idea is that I can then request data through a query for any one of this sets of data(tables) by entering the Product ID which was created in the Product master data table.

Please help an amatuer!
THANKS
 

qwkslvr1999

Registered User.
Local time
Today, 15:29
Joined
Jan 21, 2002
Messages
42
If I understand your problem correctly...

From the master Product screen, you can open another form that will take the Product ID as an argument. For example, if you will use a command button to open the form, you will have something like :

DoCmd.OpenForm "nextform", , , , , , Me![productid]

in the button's on click event.

Then in the Nextform on load event you will have:

[productid]=cstr(me.openargs)

Hope this helps...
 

lloydmav

Registered User.
Local time
Today, 20:29
Joined
Nov 15, 2002
Messages
75
Yeah I'm using data entry forms aswell, so when the user opens up the first form the Procut ID is auto created, then for the open form button to take the user to the next set of product attributes associtaed with a new table I have to add this code. Then will the autonumber that was carried accross be saved to the new record in the next table. Is that basically what your suggesting?

And also thanks for the reply
 

lloydmav

Registered User.
Local time
Today, 20:29
Joined
Nov 15, 2002
Messages
75
I haven't been able to try it for a while but now I have I keep getting the error message on the forms load event;

Run-time error '2448'
You can't assign a value to this object.

I can't discover why, its an autonumber I'm trying to take across to the next form to a field which is a Long Integer.

Anyone know what I'm getting wrong?
 

lloydmav

Registered User.
Local time
Today, 20:29
Joined
Nov 15, 2002
Messages
75
That's Interesting! Even when I comment the code out, that I entered into the load event, I still get the error message. As long as a load event exists eg. there is a Private Sub and End Sub I get the error message.

What the hell is going on?
 

qwkslvr1999

Registered User.
Local time
Today, 15:29
Joined
Jan 21, 2002
Messages
42
Is the ProductId in the second form(table) autonumbered too? If Yes, this should be set to Long Int.

If this doesn't work out, can you send me a copy of your db?
 

Users who are viewing this thread

Top Bottom