Open "FIND" on form open - code and placement needed

dwcrockford

New Member
Joined
Sep 1, 2015
Messages
27
Firstly, thanks to those that have assisted me with my "novice" questions. I have learned alot and have my database working great due to the help received.

Now that it is functional and relatively user friendly, I am moving to the fine-tuning aspect.

I have a number of forms created that are specific to editing/updating information. No issues with the forms or the data behind them.
As these are "update info" forms, I currently have a command button on each form to find a specific record... and it works great (with the exception of having to set the "partial field" and "current field" parameters to search all or any part of.... minor in my eyes at the moment.

So my question is; How do I insert a code in the "on open" action of the form which will automatically also open the "find" window, with the parameters set to "any part of field" and "all fields" without having to click my search button (or cntl F shortcut). I copied the macro from the button, and re-entered the code (macro) on the "on open" location, but it does not work. I don't want the code to find a specific record and have tried coding it as an event procedure (instead of a macro), but it won't let me leave the Criteria empty and just open the find window so I can enter the desired details I want it to look for (different each time).

Note: I also would like (and currently have) on open code (event) that places the position and size of the form on my screen (relative to screen, not relative to other windows), and would like to keep that code intact. The code being used in the event procedure to do this is:

-----
Private Sub Form_Load()


DoCmd.MoveSize 5760, 340, 13300, 12500


End Sub
-----

So any additional coding I can add to this on-open event will hopefully not conflict with the above.

Help/Guidance?

Thanks yet again
Daryl
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I suppose you could open the 'Find and Replace' dialog with the SendKeys function if that's what you mean. If not, I don't know what you're referring to. I think it would be SendKeys "^F",True
Manipulating the dialog choices would take some robust Windows API coding, which I have no idea how to do. Even if I did, I can't imagine going to the trouble for this. Hard to say which makes the least sense; programming actions that should be left to a user (it may not always be desired?) or not filtering the form results before it opens.
If your form is bound to a table or query, I don't get why you aren't just going to the record in a recordset based on a chosen combobox value or user input in a textbox on that form. Or why you don't provide a method to open the form to just one record. In the first scenario, your button should be running a Docmd.FindRecord sub where you can set the search parameters you refer to. You could even provide option buttons to allow user to choose these parameters if you wanted. If you don't want all that on your main form, a popup form with a combobox and option buttons might be better.
 
Last edited:
Upvote 0
Firstly, thanks to those that have assisted me with my "novice" questions. I have learned alot and have my database working great due to the help received.

Now that it is functional and relatively user friendly, I am moving to the fine-tuning aspect.

I have a number of forms created that are specific to editing/updating information. No issues with the forms or the data behind them.
As these are "update info" forms, I currently have a command button on each form to find a specific record... and it works great (with the exception of having to set the "partial field" and "current field" parameters to search all or any part of.... minor in my eyes at the moment.

So my question is; How do I insert a code in the "on open" action of the form which will automatically also open the "find" window, with the parameters set to "any part of field" and "all fields" without having to click my search button (or cntl F shortcut). I copied the macro from the button, and re-entered the code (macro) on the "on open" location, but it does not work. I don't want the code to find a specific record and have tried coding it as an event procedure (instead of a macro), but it won't let me leave the Criteria empty and just open the find window so I can enter the desired details I want it to look for (different each time).

Note: I also would like (and currently have) on open code (event) that places the position and size of the form on my screen (relative to screen, not relative to other windows), and would like to keep that code intact. The code being used in the event procedure to do this is:

-----
Private Sub Form_Load()


DoCmd.MoveSize 5760, 340, 13300, 12500


End Sub
-----

So any additional coding I can add to this on-open event will hopefully not conflict with the above.

Help/Guidance?

Thanks yet again
Daryl

Daryl,

The built in Find function does work but is very limited.

I like to use my own search form that is much more powerful and user friendly.

For an example see: Microsoft Access tips: Search criteria

Search2000.gif
 
Upvote 0

Forum statistics

Threads
1,221,838
Messages
6,162,286
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top