No current ID

kevygee

Registered User.
Local time
Today, 11:58
Joined
Jun 7, 2005
Messages
32
There's this problem that has been racking my brain all day. I have a form that contains a subform (modelling a many to many relationship). So a person and the applications he/she uses. I then have a combobox with a list of applications and a button below the combobox. When something is selected from the combobox and then the button is pressed, the application gets connected to the user. The problem I'm having is that say a person is just being added and no information is entered yet. If the user tries to add an application, my code tries to tie the two key's (autonumber id's) together (but there isn't one yet for the non-existant person) and the code blows up. Shouldn't access just make one when the form is opened? I guess access waits until there is data added in order to create a new primary key.

So I really don't have a clue how to solve this issue. I tried just running an insert SQL statement but I have no data to insert. And then, I would have to use a DLookup for the id, but I would have nothing to search on. I really don't know how to fix this problem. Any ideas?
 
Disable the ComboBox on a new record until after it has been completed and saved.
 

Users who are viewing this thread

Back
Top Bottom