Switchboard questions...

J

jsmith

I have added a button to my switchboard to edit existing entries (in case my
data entry person makes a mistake, etc.), but when I chose that button, it
starts at the beginning of all existing entries and I have to scroll through
the entire form to move onto the next entry. Can I make some sort of look up
question that will only pull entries either by date, and/or last name, and/or
account number? Some way to allow her to enter parameters so she doesn't
have to scroll through hundreds or thousands of entries?

Thank you for your time and knowledge.

JSmith
 
T

Todd Shillam

jsmith said:
I have added a button to my switchboard to edit existing entries (in case
my
data entry person makes a mistake, etc.), but when I chose that button, it
starts at the beginning of all existing entries and I have to scroll
through
the entire form to move onto the next entry. Can I make some sort of look
up
question that will only pull entries either by date, and/or last name,
and/or
account number? Some way to allow her to enter parameters so she doesn't
have to scroll through hundreds or thousands of entries?

Thank you for your time and knowledge.

JSmith

JSmith,

You could add an unbound combobox to your form--then set the Row Source
property to get your list values. Then (on your button's OnClick event), you
add some code that opens your form to the selected record:

Private Sub btnName_Click()
On Error GoTo Err_btnName_Click 'ON ERROR GOTO (See Below)

'DECLARE VARIABLES
Dim stDocName As String
Dim stLinkCriteria As String

'INITIALIZE VARIABLES
stDocName = "TheFormYouWantToOpen" <--CHANGE THIS TO YOUR FORM NAME
stLinkCriteria = "[NumberID]=" & Me![Combo0] '<--THIS IS THE WHERE
CLAUSE

'COMMAND TO OPEN FORM WITH WHERE CLAUSE
DoCmd.OpenForm stDocName, , , stLinkCriteria '<--THIS CODE
OPENS YOUR FORM TO THE CHOSEN RECORD

Exit_btnName_Click:
Exit Sub

Err_btnName_Click:

If MsgBox("You Must Choose From the List.", vbOKOnly + vbExclamation,
"Attention") = vbOK Then
Me![Combo0].SetFocus
Else
Response = acDataErrContinue
End If

Resume Exit_btnName_Click

End Sub



Best regards,

Todd Shillam
 
Top