I am trying to create a button that will OPEN "CAREPLAN" and CLOSE "PSAFILES".
PSA Files has a data field called "PSAID" and is an autonumber and must auto fill in "CAREPLAN" as "PSAID"
I had something like the below but it's not working for whatever reason.
------
Option Compare Database
Private Sub CarePlan_Click()
On Error GoTo Err_CarePlan_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CarePlan"
If Me.Dirty Then DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[PSAID]=" & Me![PSAID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "PSAFiles"
Exit_CarePlan_Click:
Exit Sub
Err_CarePlan_Click:
MsgBox Err.Description
Resume Exit_CarePlan_Click
End Sub
-------
PSA Files has a data field called "PSAID" and is an autonumber and must auto fill in "CAREPLAN" as "PSAID"
I had something like the below but it's not working for whatever reason.
------
Option Compare Database
Private Sub CarePlan_Click()
On Error GoTo Err_CarePlan_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CarePlan"
If Me.Dirty Then DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[PSAID]=" & Me![PSAID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "PSAFiles"
Exit_CarePlan_Click:
Exit Sub
Err_CarePlan_Click:
MsgBox Err.Description
Resume Exit_CarePlan_Click
End Sub
-------