K
ketbd
I am sure this is simple for most of you but I am stumped.
I have a form PT_Demog that needs to open another form PT_MedBasic
I created a button using the wizard to open records with Patient_ID.
Private Sub Medical_Form_Click()
On Error GoTo Err_Medical_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PT_MedBasic"
stLinkCriteria = "[Patient_ID]=" & Me![Patient_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Const cQuote = """" 'Thats two quotes
Me!Patient_ID.DefaultValue = cQuote & Forms![PT_MedBasic].
[Patient_ID].Value & cQuote
Exit_Medical_Form_Click:
Exit Sub
Err_Medical_Form_Click:
MsgBox Err.Description
Resume Exit_Medical_Form_Click
End Sub
When I open the form I want it to search for the matching records
(which it does) but if there aren't any that match I would like it to
create one that copies the Patient_ID from PT_Demog to PT_MedBasic.
This is a one to many relationship. Any suggestions?
Thanks,
Laurie
I have a form PT_Demog that needs to open another form PT_MedBasic
I created a button using the wizard to open records with Patient_ID.
Private Sub Medical_Form_Click()
On Error GoTo Err_Medical_Form_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PT_MedBasic"
stLinkCriteria = "[Patient_ID]=" & Me![Patient_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Const cQuote = """" 'Thats two quotes
Me!Patient_ID.DefaultValue = cQuote & Forms![PT_MedBasic].
[Patient_ID].Value & cQuote
Exit_Medical_Form_Click:
Exit Sub
Err_Medical_Form_Click:
MsgBox Err.Description
Resume Exit_Medical_Form_Click
End Sub
When I open the form I want it to search for the matching records
(which it does) but if there aren't any that match I would like it to
create one that copies the Patient_ID from PT_Demog to PT_MedBasic.
This is a one to many relationship. Any suggestions?
Thanks,
Laurie