Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 25th, 2003, 08:39 PM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Double search using an input text box


My problem is as follows:

I Have for example this data

ID LastName FirstName Adrress Invoice ETC.
1 McGwire Mac blablabla1 1235
2 McGwire Mary blablabla2 1257
3 McGwire Don blablabla3 1458
4 Adams Homer blablabla4 1489
5 Simpson Elvis blablabla5 1111

The Data is not indexed by ID, but I index it by LastName to make the search easy. I have created a form where the user inputs the last name to search for and the fields above are filled in when it finds the closest Match below the search box. Now I want to be able to search by LastName and then by FirstName qnd get the correct record, but because itùs indexed by LastName, I do not get it correct.

How can I solve this problem



Reply With Quote
  #2 (permalink)  
Old October 25th, 2003, 09:32 PM
sal sal is offline
Friend of Wrox
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts

What exactly do you mean by indexed?
The way you set-up an index should not have much bearing on your search, except for the fact htat if the field is not indexed, the search will take longer.
What are you using to create the search? a query?
If you create a sub-form within the main form, showing the users the results of their seqrch by last name, they will be able to view all of their people with that particulat last name, then they can use that form to re-sort by first name and get their result that way.

You could also show them how to do a filter by form.

Hope this helps. Let me know the things that I ask avobe to be able to help you more.


Reply With Quote
  #3 (permalink)  
Old October 25th, 2003, 10:29 PM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Sal and thanks for the quick reply.

I am using a pointer, that points to my data base. The code is here:

Private Sub Form_Load()

Set DB = CurrentDb()
Set MyRS = DB.OpenRecordset("tblDecClients", dbOpenTable)
MyRS.Index = "PrimaryKey"

End Sub

Private Sub txtInputSearch_Change()

  Dim strSeek As Variant
  Dim PosinMyRS As Variant

  MyRS.Index = "LASTNAME"

  strSeek = Me![txtInputSearch].Text

    With MyRS
        PosinMyRS = MyRS.Bookmark

        .Seek ">=", strSeek
        If .NoMatch = True Then

        MyRS.Bookmark = PosinMyRS

        Exit Sub

        End If


    End With

End Sub

As you can see, on the form load I force the indexing on the primarykey, but when I go to the txtInputSearch_Change(), I have to index it on the last name to search for the first approximation. In other words if I start inputing Jo, the results will imediatly jump to the closest match, for example Johnson and fill out the other fields with the corresponding data. My problem is, I want to make this routine pick two inputs simultaneously, but when I do this, it is impossible to find the correct one, because the first name is not indexed and he will never find it.

I hope I expressed myself in an understandable way.



Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing string to a text box in search engine rylemer Classic ASP Basics 0 October 26th, 2005 03:23 PM
Passing string to a text box in search engine rylemer ASP.NET 1.0 and 1.1 Professional 2 October 25th, 2005 06:11 PM
Creating an Input Mask in a text box in VB.NET ysu_computer_lab VS.NET 2002/2003 1 November 5th, 2003 02:40 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM

All times are GMT -4. The time now is 11:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.