vbYesNo MsgBox problem
Posted on 2007-08-04
Dear Experts...Can you check and edit my code for the following action. On double clicking Main_Pt_ID field in the subform, the MasgBox appears If Contract_End_Date in the parent Form is null. The user is offered to be taken to the appropriate form (through the subroutine) if he presses Yes in the vbYesNo Box else the routine exists. The subroutine that is prompted by the Yes Links the parentform Main_Pt_Id to the destination form Main_Pt_ID.
However, on Pressing yes does not execute the subroutine. Can you please check my VBA and rectify it please?
Private Sub Introduced_Pt_ID_DblClick(Cancel As Integer)
On Error GoTo Err_Introduced_Pt_ID_DblClick
If IsNull(Me.Parent!Contract_End_date) Then
iAnswer = MsgBox("You cannot Calculate Introduction Discount when the Introducing Patient's Contract End Date has not been filled. Do You want to add this information first?", vbYesNo)
If iAnswer = True Then
EditIntroducingPtContractStartDate This is the subroutine shown below
Else: Exit Sub
Private Sub EditIntroducingPtContractStartDate()
Dim stDocName As String
DimStLinkCriteria As String
stDocName = " Fo_main_Patient_List1"
stLinkCriteria = "[Main_Pt_ID]=" & Me.Parent![Main_Pt_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria