Open form to new record with macro

RexesOperator

Registered User.
Local time
Yesterday, 19:11
Joined
Jul 15, 2006
Messages
604
I really hate being stupid about this, but I'm running around in a circle and it's making me dizzy. All I want is a simple macro that opens a form (with a subform) at a new record from a button. I know I am missing something obvious so I will let others see if they can find out what has gone wrong. The current macro is:

OpenForm(FormName)..View(Form)..DataMode(Add)
GoToRecord .. ObjectType(Form) .. ObjectName(FormName) .. Record(New)

On the property sheet of the form the following are all set to yes:
Allow Filters, Allow Edits, Allow Deletions, Allow Additions, Data Entry (I suspect the problem is here)
Record Locks is set to No Locks.

When I open the form from the button, it looks right, and I can enter the transaction information, but when I try to enter the subform information or save it , I get "The Microsoft Jet database engine cannot find a record in the table 'NewContacts_tbl' with key matching field(s) 'ContactID'". I get the same message with Allow Data Entry set to no.

And yes the key field IS there, in spite of what the Microsoft Jet database says.

I hope everyone gets a chance to enjoy the holidays and thanks to all of you for your past help and my current (relative) sanity.

A2K
:(
 
Last edited:
Not sure if this helps but I woulld stay away form macros and try VBA instead... it's much more powerful
 
Did I mention my VBA skills are minimal? Like..90 percent of my VBA in this database is from code supplied by the kindness of the people in the forum?

So no this is isn't helpful - I just want to know why the macro doesn't work. Then I can fix it. But thanks for looking anyway.
 
After several frustrating hours, I finally tracked down the problem. The macro, the main form and the query were correct. At some point I changed the source of the subform to the query instead of the table. All is working fine now.
 

Users who are viewing this thread

Back
Top Bottom