Records are usually added to Access databases via forms, especially when
your trying to do so via code. Are you using a form? Or are you entering
your data into a table view? If you're using a table view to do your data
entry there are no event procedures available to tables to trigger any code.
As long as you're trying to do it with a form try:
DoCmd.GoToRecord acDataForm, "YourFormName", acNewRec
All this code will do is move the user to an empty (new) record so they can
enter data in the form. It *will not* add any data to the underlying table.
BTW, the compound primary key has nothing to do with why this is not
working.
HTH
Earl Lewis
"Ang" <aswo...@lorman.com> wrote in message
news:249b01c25f41$9e99aea0$35ef2ecf@TKMSFTNGXA11...
Well... a couple of questions here.
A Table can have one and only one Primary Key. That Primary Key might
consist of one field, or two fields, or ten fields - but it's only ONE
primary key.
And the DoCmd.GoToRecord method is not designed to add a new record to
anything. It opens up the new record, and allows a user to enter data
into that record - but it does not by itself create a record.
Could you explain a bit more about what you want to happen? How are
the values of the two fields that (apparently) make up your primary
key determined? Do you want them automatically generated, user
entered, or what? And... most importantly... what symptoms do you see
that indicate it's "not working"?
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public