| | | Pass-the-reality |  |
| Posted: Fri Sep 12, 2008 11:37 am Post subject: Command Button |  |
| |  | |
On my form (frmlookuprecords) I have only one field (text1) which captures the associates CSR (user id #). I added a Command button to frmlookuprecords using the wizard. The Command button is linked to frmMainForm. Within the Wizard I linked text 1 on frmlookuprecords to CSR on frmMainForm. This feature allows me to click on the Command button and only pull up my personal records (based on my CSR). I want to take the code one step further. On the form frmMainForm, there is a subform that contains a field called Order By. When I click the Command Button, I want it to only show my records (like it is doing now) and also only show the records where the Order By is null. The break down of this field is [frmMainForm]![frmOMSOrderBy]![Order By]. What do I need to add to the code below?
Private Sub Command7_Click() On Error GoTo Err_Command7_Click
Dim stDocName As String Dim stLinkCriteria As String
stDocName = "frmMainForm" stLinkCriteria = "[CSR]=" & "'" & Me![Text1] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command7_Click: Exit Sub
Err_Command7_Click: MsgBox Err.Description Resume Exit_Command7_Click End Sub |
|