Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2007
    Posts
    25

    Unanswered: Combine 52 queries into 1 or 2.

    I have a tab control which has 26 tabs. 1 for each letter of the alphabet. I created 26 different queries to pull data from the table that Company name begins with each appropriate letter. I Simply used...

    like "A*"

    I have it so you can hit a button then it would arrange each tab by Last name instead of Company name. Another 26 different queries for that.

    After doing so, I though that there has to be an easier way than this to accomplish the same task.

    I'm using a list box to display the results and there will be further action if a user double clicks an entry. I don't see "Criteria" as an option in the list box properties.

    suggestions welcome.

    Thanks,

    RJ
    Last edited by rjwebgraphix; 12-09-07 at 01:30.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    See the code bank! There's an example I uploaded called "Alphabetical Search" which has the A-Z buttons and uses a listbox which is based on just 1 query. I think you'll like it. The way I did it is I put an unbound text box on the form called: FType. When the user clicks on an A-Z button, it puts that letter in the FType field and then requeries the listbox. The criteria in the listbox query is Like Forms!SearchForm!FType & *. The user can also type in more letters in the FType field to narrow it down even more. There's also a grouping box where the user can select to search by first name or last name. There's a few other features which you may find useful.
    Last edited by pkstormy; 12-09-07 at 03:49.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by pkstormy
    See the code bank! There's an example I uploaded called "Alphabetical Search" ....
    Thanks, Found it, it's helping dramatically!!!

    One simple question. Is there a way that instead of recoloring the letter selected to have it display that button as "Sunken" when your currently on that page?

    I couldn't find an option in the properties for sunken, so don't know if its possible.

    Thanks again,

    RJ

  4. #4
    Join Date
    Dec 2006
    Location
    Momence, IL USA
    Posts
    56
    Visual Basic command buttons can be set to toggle, but in an Access form you need to use Toggle Button controls placed inside an Option Group (frame) control.
    Note. Even when the controls are unbound, they won't toggle (stay down) unless the form's Allow Edits property is set to True. Not knowing that caused me some WTF time, and the help file wasn't much help. Google is your friend.
    Don't Bogart That Squishee!

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I used to have some code to do this for command buttons (I don't believe it was one simple command though). I will try and find it. Another thing you could do which might even look better is to change all the buttons to text boxes. Then you could not only control the look of them being pressed/unpressed with code to change the special effects property, but you could also change the background color of the text box as well as the fore color.
    Last edited by pkstormy; 12-09-07 at 21:41.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by pkstormy
    I used to have some code to do this for command buttons (I don't believe it was one simple command though). I will try and find it. Another thing you could do which might even look better is to change all the buttons to text boxes. Then you could not only control the look of them being pressed/unpressed with code to change the special effects property, but you could also change the background color of the text box as well as the fore color.
    Yes, I tried that before posting this then gave up because it wants to allow input if its enabled, but disabled it won't run the "onClick"

    A simple idea is to use the command button until it's been clicked. After clicking, make the command button not visable and a text box for would be visable afterwards. Then it could be disabled as it wouldn't be clicked again if your already on it. I'll have to see how that appears visually.

    If it is quite complicated (The code you said you had) then I'll probably just not worry about it as it is only an appearance thing and has no bearing on function.

    Thanks,

    RJ

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Try this. It's a cheaters way of doing it but I think it's what you're looking for. You can change the background/fore colors if you want.
    Attached Files Attached Files
    Last edited by pkstormy; 12-09-07 at 22:33.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  8. #8
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by pkstormy
    Try this. It's a cheaters way of doing it but I think it's what you're looking for. You can change the background/fore colors if you want.
    Hey, if it works, thats what matters right? LOL

    Thanks. It's working well and gives the desired appearance.

    RJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •