A
Anthony
Hi
I have a form called "PostOpInstructions" which has on it a command button
that is supposed to open one of several different reports when pressed. The
code for this command button is shown below. The report that opens depends
on the value contained within a field (actually a combo box) called
"OperationType1", which is located on another form called "Operation". The
user enters data in the "Operation" form, then clicks on a command button to
open the "PostOpInstructions" form, in which more data is entered.
The problem is that the wrong report opens when I click the command button
on the "PostOpInstructions" form. The problem seems to be with the third
report (ie AntStabBVDS) because it is this report that keeps opening, even
after I have selected "rotator cuff repair" in the combo box on the
"Operation" form. I have checked that the spelling in the value list of the
combo box is the same as in the code below.
Anthony
'*********************************************************
Private Sub Command15_Click()
Dim StDocName1 As String
Dim StDocName2 As String
Dim StDocName3 As String
Dim strWhere As String
Dim stLinkCriteria As String
Dim frmF As Form
Set frmF = Form_Operation
frmF.Refresh
StDocName1 = "DHSBVDS"
StDocName2 = "RotCuffBVDS"
StDocName3 = "AntStabBVDS"
stLinkCriteria = "[PatientID]=" & Me!PatientID
strWhere = "[PatientID]=" & Me!PatientID
If frmF.OperationType1 = "dynamic hipscrew and plate" Then
DoCmd.Close
DoCmd.OpenReport StDocName1, acViewPreview, , strWhere
DoCmd.Maximize
Else
If frmF.OperationType1 = "rotator cuff repair" Then
DoCmd.Close
DoCmd.OpenReport StDocName2, acViewPreview, , strWhere
DoCmd.Maximize
Else
If frmF.OperationType1 = "anterior stabilisation" Then
DoCmd.Close
DoCmd.OpenReport StDocName3, acViewPreview, , strWhere
DoCmd.Maximize
End If
End If
End If
Exit_Report_Click:
Exit Sub
'*****************************************************
I have a form called "PostOpInstructions" which has on it a command button
that is supposed to open one of several different reports when pressed. The
code for this command button is shown below. The report that opens depends
on the value contained within a field (actually a combo box) called
"OperationType1", which is located on another form called "Operation". The
user enters data in the "Operation" form, then clicks on a command button to
open the "PostOpInstructions" form, in which more data is entered.
The problem is that the wrong report opens when I click the command button
on the "PostOpInstructions" form. The problem seems to be with the third
report (ie AntStabBVDS) because it is this report that keeps opening, even
after I have selected "rotator cuff repair" in the combo box on the
"Operation" form. I have checked that the spelling in the value list of the
combo box is the same as in the code below.
Anthony
'*********************************************************
Private Sub Command15_Click()
Dim StDocName1 As String
Dim StDocName2 As String
Dim StDocName3 As String
Dim strWhere As String
Dim stLinkCriteria As String
Dim frmF As Form
Set frmF = Form_Operation
frmF.Refresh
StDocName1 = "DHSBVDS"
StDocName2 = "RotCuffBVDS"
StDocName3 = "AntStabBVDS"
stLinkCriteria = "[PatientID]=" & Me!PatientID
strWhere = "[PatientID]=" & Me!PatientID
If frmF.OperationType1 = "dynamic hipscrew and plate" Then
DoCmd.Close
DoCmd.OpenReport StDocName1, acViewPreview, , strWhere
DoCmd.Maximize
Else
If frmF.OperationType1 = "rotator cuff repair" Then
DoCmd.Close
DoCmd.OpenReport StDocName2, acViewPreview, , strWhere
DoCmd.Maximize
Else
If frmF.OperationType1 = "anterior stabilisation" Then
DoCmd.Close
DoCmd.OpenReport StDocName3, acViewPreview, , strWhere
DoCmd.Maximize
End If
End If
End If
Exit_Report_Click:
Exit Sub
'*****************************************************