Kamis, 20 Juni 2013

Re: [MS_AccessPros] Split Database Issue 1- search not working in accde

 

Hmmm, what I want to do is change the filter for the form based on the name the user selects from the ComboSearchNames choices (so not necessarily the first one).

I suppose that makes the purpose of the code below for ComboSearchNames.AfterUpdate ambiguous/useless.
Me.Recordset.FindFirst "[Animal ID] =" & Me.ComboSearchNames

When I comment this line out, the Master file still works, but when I make a new FE with the changes, it does not.

I'm unclear when you say "do the call". I assume you mean call the ComboSearchNames AfterUpdate routine. All the VB I've done in Access has been a little tinkering with Event Procedures as aspects of a form object's properties- so each of those is a subroutine waiting to be called- I don't really follow an idea of "running a program" when I open the form (although I suppose that is what happens)

Could you be a little more specific?

--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...> wrote:
>
> Amanda-
>
> After you update the Row Source of the combo box, it will acquire the value
> of the first row. If you want to filter on that value, do the call to the
> combo AfterUpdate after you set the Row Source.
>
> 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 7:10 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: Re: [MS_AccessPros] Split Database Issue 1- search not working in
> accde
>
> Thanks John!
>
> Where exactly are you suggesting to add the ComboSearchNames_AfterUpdate?
> To the AfterUpdate of the form?
>
> As far as the Requery and Refresh- I have no training in VB, just some
> experience from a decade ago writing VBScript for websites- so everything I
> do in Access is pretty piecemeal. I probably copied that code from
> somewhere else and never realized it wasn't necessary to update the value of
> the form.
>
> ~ Amanda
>
> --- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@>
> wrote:
> >
> > 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
> >
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)
.

__,_._,___

Tidak ada komentar:

Posting Komentar