can't add record in subform

Mr.K

Registered User.
Local time
Today, 07:52
Joined
Jan 18, 2006
Messages
104
Hi; I have a subform linked with a Main form. Both linked to seperate tables. The subform is in a Single form view. When I try to add new record (via button created with the wizard) ,using just the subform by itself, it works fine. However, when I open the main form with the subform and then try to add the record via the subform i get a message: You can't go to the specified record.

Under the New Record btn this is the code I have:
Code:
DoCmd.GoToRecord , , acNewRec

What am I doing wrong?? Do I have to somehow preset the value of the linked field in the subform so it matches the master field?

(I have allow additions, etc.. set properly, since as I said above I can add records just fine when subform is used on its own)
 
Have you set the Child and Master linking properties? This is can happen automatically or sometimes you have to set them. When you select the child table look under the data tab for these properties.
 
solution

Joebax said:
Have you set the Child and Master linking properties? ...

Yes, those were correct.TThe subform works fine now. My problem was:
I had a vba on current event in main form that was setting allowadditions to false which I completly forgot about - how stupid of me. Sometimes I think one simply has to take a brake, wake up in the morning and find the problem in 5 minutes instead of punding the head on the desk for hours the day before :o
 

Users who are viewing this thread

Back
Top Bottom