How to create a record?

geralf

Registered User.
Local time
Today, 23:00
Joined
Nov 15, 2002
Messages
212
Hi,
I have a main form and a sub form. My promary key is a calculated value, returned from a VBA function, which is called from the primary key fields' Default value.

Here's the problem:
If the user don't use the keyboard, the record in the main table is not created, so trying to do record operations/form operations in VBA results in 'no related post in the main table'. this when selecting or just accepting default values in the record.

I've tried to save the record, SendKeys to the primary key field, but it don't work. How can I get the new record created without using the keyboard?

Thanks in advance for any replies.


Regards
Gerhard
 
I would strongly recommend using autonumer primary keys instead of using a function to return the primary key value. This might help you avoid the problem you are having.

Hope this helps,
 
Thanks for your answer ans advice Peter. I'll have to do some changes then, and I don't hope Access gets to difficult in this process :) . The value created in the function is a unique value, and is ideal as a primary key. It might however be a big difference whether Access creates it as an autonumber or if it's created in a function.

Thanks again

By the way, I visited your web site, and found many interesting tools, one in pariculary - the 'drag n'drop' tool. Can this be used in a continous sub form to change the record positions?


Regards
Gerhard
 

Users who are viewing this thread

Back
Top Bottom