Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the Find Record setting for a Combo Box in Access 2013

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I have a form set to Single record view. To help my users find a specific record I set up a combo box using the Combo Box Wizard and then selecting the "Find a record on my form based on the value I selected in my combo box" selection. I finished creating the ComboBox.

Here is the embedded macro that was created by the wizard:
SearchFor Record
Object Type (Blank)
Object Name (Blank)
Record First
Where Condition ="[ID] = " & Str(Nz([Screen].[ActiveControl],0))

After saving and opening the form in Form View...everything works. When I make a selection with the combo box that record shows on the form.

When I save and close the DB and then reopen it and then make a selection on the combo box I get this message:

Object or class does not support the set of events "OK"
When I select OK it shows the macro in single step showing:

Macro Name: Tasks Form:Combo98:AfterUpdate:Embedded Macro
Condition (Blank)
Action Name: SearchForRecord Error 2950
Arguments:
-1, , First, ="[ID] = "& Str(Nz([Screen].[ActiveControl], 0))

I checked Error 2950, on the WEB, and set the location of the DB as a trusted site. This did not fix the problem.

Any Suggestions?
 
What if you fill in names where there are blanks?
Object Type (Blank)
Object Name (Blank)
 
I will give it a try but I would have expected the wizard that created the macro to do that. And, remember, if I don't close the DB it works. Only after I close and reopen the DB does it fail.

Thanks for the suggestions I will let you know the results.
 
In the afterupdate event of the combobox

me.recordset.findfirst "[ID] = " & me.YourComboBoxName
 
I'd double check the 'trust' setting you have for the folder holding the database. Access will run code/macros, when going from Design View straight into Form View, and then running it, even with the folder not 'trusted,' but will balk when closing the Form and then opening it directly, in Form View, under the same conditions.

Apparently the Access Gnomes assume that if you are developing the db (an assumption they make because you were in Design View,) you can be trusted to run the code/macros, even if the file is not in a 'trusted' location...but if you're opening the Form directly in Form View, you could be a simple user, and need to follow the 'trusted' rule, as it were!

Linq ;0)>

Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top