Johnny Drama
In need of beer...
- Local time
- Today, 11:20
- Joined
- Dec 12, 2008
- Messages
- 211
Hello all,
I've got an interesting situation that I can't figure out for the life of me. I have a form where users can select a control number from a combo box. They then click a command button which passes the control number they selected (and the associated control data) to a form. It was working fine until I added a criteria for the CategoryID in the query the form pulls data from. Now when I click the command button it pops up a box asking for the CategoryID value and then a second box asking for the Control Number value.
Thoughts? Command button code below:
Private Sub btn_viewleadsheet_Click()
On Error GoTo Err_btn_viewleadsheet_Click
DoCmd.RunCommand acCmdSaveRecord
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptPhaseOneLeadSheet"
stLinkCriteria = "[Category] & "'" & [Control Number] = " & " '" & Me![Test Control] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_btn_viewleadsheet_Click:
Exit Sub
Err_btn_viewleadsheet_Click:
MsgBox Err.Description
Resume Exit_btn_viewleadsheet_Click
End Sub
Thanks in advance
I've got an interesting situation that I can't figure out for the life of me. I have a form where users can select a control number from a combo box. They then click a command button which passes the control number they selected (and the associated control data) to a form. It was working fine until I added a criteria for the CategoryID in the query the form pulls data from. Now when I click the command button it pops up a box asking for the CategoryID value and then a second box asking for the Control Number value.
Thoughts? Command button code below:
Private Sub btn_viewleadsheet_Click()
On Error GoTo Err_btn_viewleadsheet_Click
DoCmd.RunCommand acCmdSaveRecord
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptPhaseOneLeadSheet"
stLinkCriteria = "[Category] & "'" & [Control Number] = " & " '" & Me![Test Control] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_btn_viewleadsheet_Click:
Exit Sub
Err_btn_viewleadsheet_Click:
MsgBox Err.Description
Resume Exit_btn_viewleadsheet_Click
End Sub
Thanks in advance
Last edited: