Wildcard Text Box

jdbegg

New member
Local time
Today, 10:21
Joined
Mar 13, 2003
Messages
24
I'm relatively new at trying any advanced stuff with MS Access, so I don't know if this can be done. I've seen it done many times in other applications.

What I have is a form/subform combination that looks up people's names and if they've been invited to or attended different work functions. I have a one to many table structure with person being the driving table (one) to functions attended (many) table. I'm able to go from one record to the next, but want to add an additional feature.

I would like to be able to type a name in, say "Hayley" or a part of a name, "Hay" and have the pointer/position of the cursor go to that point in the data. How would I go about doing this if it can be done at all? I'm functionally illiterate in VB.

I've read through other posts and found some neat tidbits of information, but nothing that corresponded to my question.

Thanks in advance.

jdbegg
 
This is definitely possible and a cool feature to build in. I assume you'll have a textbox where the user can type data into, and a listbox where the cursor position will be searching for the matching data.

Build code into the On Change event of your textbox have code to do a search of your listbox recordsource for the nearest match.

I haven't got time now to write out the details. Will do it later tonight if I have a chance.
 
dcx, thanks for the reply.

Yes, I do want to be able to type something into a text box and have the cursor position find matching data. I don't know about using a listbox as I've never had a reason to use one up to this point.

Any help will be greatly appreciated.

jdbegg
 
Have a look at the attachment. It may be what you are looking for


Cheers!!!!!!




Lou
:cool:
 

Attachments

Wildcard Search Too

I have a similar problem to this. I would like to do the same (a real-time search), but update the results in a query that is a subform. The search field, named [SearchBox] is on the main form, and the Query is named qryRimSheet. The field I am trying to search by is a text field named [ACCTNAME].

Here is my code that is no good:


Private Sub SearchBox_change()



Dim sSql As String
Dim sCriteria As String

On Error GoTo errorhandler
sCriteria = "Where 1=1 AND qryRimSheet.ACCTNAME like """ & Me![SearchBox] & "*"""

sSql = "Select Distinct [ACCTNAME],[LINE],[RIM],[ZONE],[ALARMNAME] from qryRimSheet " & sCriteria
Forms![Form1]![qryRimSheetsubform].Form.RecordSource = sSql
Forms![Form1]![qryRimSheetsubform].Form.Requery

errorhandler:
MsgBox Err.Description
Resume ErrorHandlerExit

ErrorHandlerExit:
Exit Sub


End Sub


(I added the Error Handler later, but it was no help) Basically nothing happens, except that it seems to work if the data is already in the search field when you open the form, and then delete the data in the search field.

Any Suggestions?????

Thx in advance.
 

Users who are viewing this thread

Back
Top Bottom