Jumat, 17 Mei 2013

[MS_AccessPros] Re: Event procedure does not work in compiled accde

 

Amanda

No need to use the RecordsetClone or requery the combo. This should work.

Private Sub ComboSearchNames_Click()
Me.Recordset.FindFirst "[Animal ID] =" & Me.ComboSearchNames
Me.txtString = Null
End Sub

--- In MS_Access_Professionals@yahoogroups.com, "Amanda B" <amandabyrne@...> wrote:
>
> Good news! I have discovered how to get my textbox to fill in my dropdown. I used the method described here:
>
> http://stackoverflow.com/questions/2871155/filtering-a-listbox-based-on-combobox-selection
>
> After compiling- this worked like a charm
>
> However, the code that refreshed the form with the selected dropdown option is not working, so I'm moving on to next problem...
>
> I think it's the same code for the ComboSearchNames_Click() event that causes the form to refresh- so why wouldn't this be working?
>
> --- In MS_Access_Professionals@yahoogroups.com, "Amanda B" <amandabyrne@> wrote:
> >
> > I recently converted to a split database due to errors we were encountering with multiple users. The backend resides on the server, and the front end accde file resides on local machines.
> >
> > The split database master file I used to create the front end does not report any errors with I use Debug>Compile in the VBA
> >
> > However, there is a key event procedure on one of the forms that does not function when I make the accde version of the database. It is a textbox named txtString. Users use this textbox to search records and populate a drop down based on the text entered, and thus populate the form.
> >
> > The code for the txtString AfterUpdate is:
> >
> > Private Sub txtString_AfterUpdate()
> > 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
> > End Sub
> >
> > The code for the related Combo SearchNames dropdown OnClick event is:
> >
> > Private Sub ComboSearchNames_Click()
> > Me.RecordsetClone.FindFirst "[Animal ID] =" & Me.ComboSearchNames
> > Me.Bookmark = Me.RecordsetClone.Bookmark
> > Me.txtString = Null
> > Form.Refresh
> > Me.[ComboSearchNames].Requery
> > End Sub
> >
> > The Combo SearchNames RowSource is a query defined in the RowSource property (i.e. there is not a separate 'dedicated' query that it calls)
> >
> > Why would this not work in the compiled version? T
> >
> > Gratefully, Amanda
> >
>

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

__,_._,___

Tidak ada komentar:

Posting Komentar