Command Button

P

Pass-the-reality

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

View Specific Records within a form 1
Subform 0
view specific forms 1
Code to open a query 2
Command button 1
I figured out the issue thank you. 0
Choose report does not work in 2007 0
subform 1

Top