Rich said:
Hi,
I have a form that is attached to a table with our customer list. In
the customer list there is a drop down box that lets the user
indicate if the customer has been called by choosing a variety of
answers.
My question is: Is there any way to make it so when i click a the
button that opens the form that the form will go to the first record
that does not have antthing entered in the "Survey status" field?
Thanks in advance-Rich
Sure, but it takes a bit of VBA code. Let's suppose you currently have
an event procedure for your button's Click event that looks something
like this:
'----- start of example, wizard-built code -----
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustomerList"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
'----- end of example, wizard-built code -----
That's the sort code the Command Button Wizard makes -- yours may be
somewhat different, and I'm assuming for the example that your form is
name "frmCustomerList". Anyway, you can add a a single line to this
code, making it look like this:
'----- start of revised code -----
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustomerList"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(stDocName).Recordset.FindFirst "[SurveyStatus] Is Null"
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
'----- end of revised code -----
I've assumed that the field in question is named "SurveyStatus" -- you
may have to change that.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)