Combo box or event question - I'm not sure

P

PeggyBall

When choosing a member from the combo box on the search form, once edits are
made I want to be able to scroll (forward or backward) to the next records.

Membership database with 400 members. I have a form to enter/edit member
data. I have a search form - using a combo box to select the member I want
to edit. When choosing the member from the combo box the form opens
correctly but as 1 (filtered) record.
 
K

Ken Snell \(MVP\)

Please give us more details about the code you're using to open the form.
Not sure why you need to open another form? Could just use the combo box to
"move" the form to the desired record without having to open another form.
 
S

Steve

To get rid of the 1 (filtered) record problem, open your membership form in
design view. Click on the Properties icon in the menu to open the properties
dialog. Go to the Data tab and delete what is in the FilterBy property.

Put the following code in the Click event of the button that opens your
search form:
DoCmd.OpenForm "NameOfSearchForm",,,,,acDialog
DoCmd.OpenForm "NameOfMembershipForm",,,"MemberID = " &
Forms!NameOfSearchForm!NameOfComboboxOnSearchForm
DoCmd.Close "NameOfSearchForm"

Note --- You should have three DoCmd lines. The second one is long and wraps
here.

Put the following code in the AfterUpdate event of the combobox on the
search form:
Me!NameOfCombobox.Visible = False

When you click the button, your search form will open. The AcDialog in the
code causes the code to pause. When you select the member in the combobox,
the search form becomes not visible causing the code at the button to
resume. The second DoCmd opens the membership form to the member you
selected. The third DoCmd closes the serach form.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
S

scubadiver

I have the following code in the "after update" event. [EmpName] is the box
I am searching and [EmpSrch] is the search box itself.


Dim rstClone As Object

Set rstClone = Me.RecordsetClone
rstClone.FindFirst "[empName]= '" & Me.EmpSrch & "'"
Me.Bookmark = rstClone.Bookmark
Set rstClone = Nothing
Me.EmpSrch = Null

You can alternatively use this code with a combo box.

I personally have a cascading combo with two combo boxes and a list box so I
choose my department, subdepartment which brings up the list of names. When I
click on the name it automatically takes me to that record.

Hope it helps!
 

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

Top