subform in data entry mode

G

Guest

I have a main form with a synchronized subform. In the properties of the
subform I selected data entry and when I open the main form the subform comes
up blank ready for entering a new record, which is what I want. However, when
I go to another record in the main form the subform no longer is blank but
shows the last record from the record in the main form. How can I get the
subform to remain blank and ready for a new record entry?
 
S

strive4peace

sounds like you have not set

LinkMasterFields
Linkchildfields

for the subform

this is preferable to using a query that you set criteria in

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
G

Guest

Thank you for your response, but I have set the "Link Masterfield" and "Link
Child Field" to "Client ID" for the subform.
 
S

strive4peace

Do you have criteria in the recordset of your your subform?

try this on the form OnCurrent event:

me.subformcontrolname.form.requery

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
G

Guest

I don't have criteria in the recordset of the subform, so requerying did not
help. But you put me on the right track by getting me to look at the
OnCurrent event. All I had to do was add this event procedure to OnCurrent:
Private Sub Form_Current()
DoCmd.GoToRecord , , acNewRec

Exit_Ad_new_Visit_Click:
Exit Sub

Err_Ad_new_Visit_Click:
MsgBox Err.Description
Resume Exit_Ad_new_Visit_Click

End Sub

This solved my problem. Thanks a lot.

JK
 
S

strive4peace

Hi JK,

thanks, but if you need to do that, something is wrong...
the subform should be synchronized with the main form and
the fact that it is not suggests another problem if you are
seeing records on it when there are none to show ...


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
S

strive4peace

Hi JK,

try this on the form OnCurrent event:

me.subform_controlname.form.requery



Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top