473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Search Number Two

OK folks I am having a serious brain fart here and can't get the code
to do what I really want done. I have a form that has a multi-table
query as its data source. The data is dsplayed on the form as a
series of text boxes and combo boxes. I want to have a button that
when clicked will search the previous control (as long as it is one of
the text boxes or combo boxes that contain data) for the text the user
requests. The search should only be performed on the data displayed
in the given previous control. If the previous control is a text box,
the serach should look for the requested text in the bound field. If
the previpous control is a combo box, the serach should look for the
requested text in the field displayed in the combo box, hoever I dont
want it to serach the available values in the combo box, I want it to
search the records for any who have the selected valeu containing the
search text. If it would help any I can put a hidden text box with
the displayed data element of the combo box somewhere on the form.
Anyone want to take a stab at this?

Thanks...

Feb 20 '07 #1
4 1740
DavidB wrote:
OK folks I am having a serious brain fart here and can't get the code
to do what I really want done. I have a form that has a multi-table
query as its data source. The data is dsplayed on the form as a
series of text boxes and combo boxes. I want to have a button that
when clicked will search the previous control (as long as it is one of
the text boxes or combo boxes that contain data) for the text the user
requests. The search should only be performed on the data displayed
in the given previous control. If the previous control is a text box,
the serach should look for the requested text in the bound field. If
the previpous control is a combo box, the serach should look for the
requested text in the field displayed in the combo box, hoever I dont
want it to serach the available values in the combo box, I want it to
search the records for any who have the selected valeu containing the
search text. If it would help any I can put a hidden text box with
the displayed data element of the combo box somewhere on the form.
Anyone want to take a stab at this?

Thanks...
So, let me see if I understand this... you want to know what control the
user previously hit before clicking the command button, and base a query
off that?

This could be fun, if your a bit masochistic (^:

Off the top of my head, this sounds like a fun code project. Create a
global variant in the form's code module to store a control's value.
Next in each of the subject controls you will need to write code in the
Lost_Focus event that stores the value of the control that was exited.

When the button fires, code must build a query to execute on the fly
using the stored value. Since the input type can vary (alpha, numeric,
or Null) you will probably need to build some decision making to create
the query syntax appropriately.

Note also, someone might hit the button without having exited a subject
control, and you will need to account for this also.

Having said all that, this seems an awkward and unintuitive way (from a
user's perspective) to build a query. What's behind this?

--
Smartin
Feb 21 '07 #2
Smartin wrote:
So, let me see if I understand this... you want to know what control
the user previously hit before clicking the command button, and base
a query off that?

This could be fun, if your a bit masochistic (^:

Off the top of my head, this sounds like a fun code project. Create a
global variant in the form's code module to store a control's value.
Next in each of the subject controls you will need to write code in
the Lost_Focus event that stores the value of the control that was
exited.
Or the button's code could just use...

Screen.PreviousControl

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Feb 21 '07 #3
In article <m6*******************@newssvr21.news.prodigy.net> ,
ri*********@hotmail.com says...
Smartin wrote:
So, let me see if I understand this... you want to know what control
the user previously hit before clicking the command button, and base
a query off that?

This could be fun, if your a bit masochistic (^:

Off the top of my head, this sounds like a fun code project. Create a
global variant in the form's code module to store a control's value.
Next in each of the subject controls you will need to write code in
the Lost_Focus event that stores the value of the control that was
exited.

Or the button's code could just use...

Screen.PreviousControl

I know how to use previuoscontrol and in fact my object naming
convention is such that it is easy for me to determine if the previous
control was a text box, combo box, or other object. Other objects would
give the user a message to pick an appropriate field to search on. That
all I have down. What I dont know how to do is simulate the search
functionality of the built in search in access. the find, find next,
etc AND how to do that not only on a text box on the calling form but
also on a combo box (searching on the displayed value rather than the
stored value.
Feb 21 '07 #4
On Feb 20, 9:03 pm, Swans, What Swans? <f...@barkingpumpkin.ooo>
wrote:
In article <m6NCh.46950$Gr2.30...@newssvr21.news.prodigy.net> ,
rickbran...@hotmail.com says...


Smartin wrote:
So, let me see if I understand this... you want to know what control
the user previously hit before clicking the command button, and base
a query off that?
This could be fun, if your a bit masochistic (^:
Off the top of my head, this sounds like a fun code project. Create a
global variant in the form's code module to store a control's value.
Next in each of the subject controls you will need to write code in
the Lost_Focus event that stores the value of the control that was
exited.
Or the button's code could just use...
Screen.PreviousControl

I know how to use previuoscontrol and in fact my object naming
convention is such that it is easy for me to determine if the previous
control was a text box, combo box, or other object. Other objects would
give the user a message to pick an appropriate field to search on. That
all I have down. What I dont know how to do is simulate the search
functionality of the built in search in access. the find, find next,
etc AND how to do that not only on a text box on the calling form but
also on a combo box (searching on the displayed value rather than the
stored value.- Hide quoted text -

- Show quoted text -
David:

Take a look at the FindRecord Action in help for dealing with
searching for records. Note that the field you're going to search in
has to have the focus. Combo boxes are only searchable on the stored
value as far as I know, though you can get what the displayed text of
a combo box is by using the Column property of your combo box if you
want to search some other text field for the displayed text. The
counting of columns is zero based, so column 1 is really 0 and column
2 is 1. So, if you wanted to grab the displayed text of a 2 column
combo box and the first column is your bound column and the second
column is the displayed text, you'd use something like this in your
code:
stMyDisplayedText = Me.MyComboBoxName.Column(1)

HTH,
Jana

Feb 21 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
0
by: todd | last post by:
here is a search tool SP I wrote. How many times have you wanted to search all your Stored procs or views (in a database) for a keyword but couldn't!? Well now you can! THis can makes life a...
1
by: disaia | last post by:
2 problems: Example: If a person types in a part number into Yahoo: 1. Is there a way for Yahoo to list your web site as one of the results. 2. If the user clicks on your link, can your web...
1
by: damjanu | last post by:
Dear All; I have 3 issues 1) On some of my tables I have unique indexes, so that for example no two phone numbers can be the same. When user enters phone number that already exists, a scary...
1
by: Eric | last post by:
Hi: I have two files. I search pattern ":" from emails text file and save email contents into a database. Another search pattern " field is blank. Please try again.", vbExclamation + vbOKOnly...
2
by: Robert Jacobs | last post by:
Please Help! I have read over and over again to go to Allen Browne's website to filter subforms, but I just don't understand it, and I can't get it to work in my situation. Any advice is very...
2
by: parasuram | last post by:
Hi friends ............. this is a question regarding the data structures trees Pleas post it if possible with in 2 days I will thankful if some body could help doing this. Operating...
13
by: jfarthing | last post by:
Hi everyone! I am using the script below to search a db. If the is more than one match in the db, all goes well. But if there is only one match in the db, nothing gets displayed. Any...
3
by: mercuryshipzz | last post by:
#!/usr/bin/perl #use strict; use warnings; sub search_pattern { my $file_name = $_;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.