Amanda-
Changing the value of a control (in this case, your combo box) won't fire
the AfterUpdate event of the control. If you want to fire it from the
AfterUpdate of the combo box, you need to add:
ComboSearchNames_AfterUpdate
.. to fire the event from code and apply the filter to the form.
By the way, you don't need to Requery the combo box. Resetting the Row
Source does an automatic Requery. I'm also wondering why you have included
Me.Refresh.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Amanda B
Sent: Wednesday, June 19, 2013 5:40 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Split Database Issue 1- search not working in accde
I posted a couple of weeks ago- we started having corruption problems with
our Access database, so I followed recommended procedures for creating a
front end file on the local pcs, and a table file on the shared server.
The setup now consists of 3 files: a file on the server with the backend of
the database, a "master" file on the server that is still combined- with
forms and linked tables (linked to the same backend file, used to make
design changes), and a copy of a front end file on each user pc.
I'm continuing to have three problems since this split. All three problems
are not issues with the master file. The first is described below (I'll
write up the others in separate posts)
1. Search functionality on the primary search form is not working. It did
work temporarily, but we had a glitch. I restored a backup of the file and
modified it several times- each time the search worked fine in the master,
but failed in the front end file.
The search works with an Unbound text box to enter text for the search.
This box has an "AfterUpdate" event with the following code:
Private Sub txtString_AfterUpdate()
Me.ComboSearchNames.Requery
Dim strQuery As String
strQuery = "SELECT [Animal Records].[Animal ID], [Animal Records].[House
Name], [Animal Records].[Aliases] FROM [Animal Records] WHERE ([Animal
Records].[House Name] LIKE '*" & Me!txtString.Value & "*'OR [Animal
Records].[Aliases] LIKE '*" & Me!txtString.Value & "*') ORDER BY [Animal
Records].[House Name];"
Me!ComboSearchNames.RowSource = strQuery
Me!ComboSearchNames.Visible = True
Form.Refresh
End Sub
There is a Dropdown next to the Searchbox that populates with the results of
the search so the user can select the appropriate one.
Private Sub ComboSearchNames_AfterUpdate()
Me.Recordset.FindFirst "[Animal ID] =" & Me.ComboSearchNames
Form.Filter = "[Animal ID] =" & Me.ComboSearchNames
Form.FilterOn = True
Form.Refresh
Me.txtString = Null
End Sub
When using the front end file to access the database, the dropdown populates
correctly, but the form does not refresh to the appropiate record. When
using the Master file, the form goes to the correct record just fine.
I have decompiled and recompiled, but this did not help.
Any suggestions about changes to the code that might work more consistently?
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar