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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VB query

Status
Not open for further replies.

iono

Programmer
Oct 14, 2001
31
0
0
GB
I have an event procedure:

" Private Sub cmdFindName_Click()
On Error GoTo Err_cmdFindName_Click
Me![Last Name].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFindName_Click:
Exit Sub

Err_cmdFindName_Click:
MsgBox Err.Description
Resume Exit_cmdFindName_Click

End Sub"

which brings up the Find and Replace box. Problem is the 'Look In' defaults to Last Name and the whole database - is there a way of adding fields to the 'Look In' box ?

alternatively how can i set the default field to the one on the form that the cursor is on ?

any ideas ?

regards
iono
 
Consider rolling your own find and replace functionality. That way you can control the scope and depth of it. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
I'd appreciate help with rolling my own !
 
Let’s start with the basics and see if we can grow this into something viable which will give you at the least what you want.

There are two distinct types of find/replace processes, the first, and I think this is the one which holds your interest searches and or replaces items in a form or a document during run time. Find all occurrences of the word blind in “three blind mice” and replace it with the word “silly”. And then there is the find and replace which is more along the lines of a development tool. Look for something across the entire database and report back where each occurrence is and it’s point of reference. This is a bit harder and if this is what you really want, there are two very good commercial products, one of which is less than $30.00, and, if this is what you want, we have solved your problem already.

So, first step is to decide which you want to develop. Assuming you want the first variety. There are some questions you need to answer. You need to limit the range and scope of your search. Obviously you want to search beyond the scope of just one control, unless, perhaps that control contains a document, spreadsheet, report, etc. I would assume you wish to scan all variables within at least the active form. Supposing you have more than one form on your screen. Do you want to scan all open objects? Do you want to scan the underlying recordset/table(s) behind the form(s). do you want to search for text, or, numbers, or dates. Would it be better to search by specific data type or can you get away with assuming everything to be a variant (hint hint).

Is this specific to one application or do you want it to be used across various Access applications.

Consider, also, how you want to activate this functionality. Do you want to use a key sequence, a function key, a separate tool bar? A new icon on a currently existing tool bar.

You really need to do at least this much before you even consider the first line of code.
Once you know exactly what you want to do and how you want to do it, you need to take a bit more time and look in the free public domain to see if someone else has already done what you want and is giving the product away. Look at all, or as close to all as you can get, the Access help groups, developer pages, etc, and look under free downloads. After all, why reinvent the wheel.

Hopefully, by this point, you have some suggestions to follow. I think your original answer to me, at least partly, was written because you think my initial response was brushing you off. I was not. If I had no interest I would not have answered at all. From my perspective I do not have the code to give you. If I did, you would already have it. I am, as are others here, more than willing to help you roll your own. However, I am not going to roll it for you.

So, if you are serious, use this answer and create a functional specification and post back.

Perhaps you will get very lucky and someone will drop the code in your mail box. In either case, best of luck.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
thanks a lot - following your advice
iono
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top