display data in subform

G

Guest

My from displays Members. That form has a subform that displays Doctors.
I need to add a command button to add Doctors and have them display on the
subform.
When I clisk the command button it opens a form with all my Doctors.
How can I adjust this code to open that form in ADD mode and link it to that
Parent form?

Private Sub CmdPROV_Click()
On Error GoTo Err_CmdPROV_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_ProviderDetail"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CmdPROV_Click:
Exit Sub

Err_CmdPROV_Click:
MsgBox Err.Description
Resume Exit_CmdPROV_Click

End Sub
 
G

Guest

Best bet IMO is to simply create a new stand-alone bound form which opens
when you click the button. In the FORM OPEN event, you insert this code:

DoCmd.GoToRecord , , acNewRec

Then add a button to the new form that just says "Done". When they click it,
the following code executes:

If Me.Dirty then Me.Dirty = False

Docmd.Close acForm, "frmMyFormName"
 
G

Guest

Fantastic
Thank YOU





Dennis said:
Best bet IMO is to simply create a new stand-alone bound form which opens
when you click the button. In the FORM OPEN event, you insert this code:

DoCmd.GoToRecord , , acNewRec

Then add a button to the new form that just says "Done". When they click it,
the following code executes:

If Me.Dirty then Me.Dirty = False

Docmd.Close acForm, "frmMyFormName"
 

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

Similar Threads


Top