Results 1 to 8 of 8
  1. #1
    GoodOmens is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4

    Two questions dealing with queries and radio buttons

    Hi,



    I am setting up a very simple access form that fires off one report (of two) based on user input. The reports are generated from sharepoint and are already working fine. I'm just having a little trouble streamlining the selection form.


    Ideally I would like this scenario:

    The user opens the program and sees a form with the following options: A grayed out date selection box, two unselected radio buttons and a "Submit" button.

    The user clicks on a radio button and selection box generates a week range based on the radio box selected. He then clicks submit and fires off the report.

    I already have this semi-working. What I'm having trouble with:

    1)No matter what default value I select for the radio box group(I've tried blank, null, and a random value), the first value is always selected. Is there a way for me to have no default value selected? I do this because the "after update" event ungrays the week selection box. Since the first radio box is already selected, the user has to click on the other radio box and click back. Kinda confusing for users.

    2) Right now for the week selection box I have a hard coded query that pulls the weeks from the first report (They are stored in separate tables). IE:

    Code:
    SELECT [Weeks].[Week] FROM Weeks ORDER BY [Week] DESC;

    What I would like would be the option if radio box 1 is selected, pull from :

    Code:
    SELECT [Weeks1].[Week] FROM Weeks1 ORDER BY [Week] DESC;
    If Radio box 2 is selected pull from:

    Code:
    SELECT [Weeks2].[Week] FROM Weeks2 ORDER BY [Week] DESC;
    Is there any easy way to do this? I know I could just union the two weeks - but there are times when a week doesn't have a particular report so I only want to have weeks shown that have reports.

    Thanks!

  2. #2
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    For Question 1) - Have you tried setting the value to null when the form loads?
    For Question 2) - Have you tried an If...Then kicked off on After Update?

  3. #3
    GoodOmens is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    Quote Originally Posted by TG_W View Post
    For Question 1) - Have you tried setting the value to null when the form loads?
    That's what was causing it seems. I thought setting the "default" value would reset things on form load but I guess that was not the case. That solved that problem!

    Quote Originally Posted by TG_W View Post
    For Question 2) - Have you tried an If...Then kicked off on After Update?
    Ah cool. I didn't realize you could update the RowSource with a string. Got it working!

    Thanks for such a quick response.
    Last edited by GoodOmens; 04-24-2012 at 10:19 AM. Reason: Got it working

  4. #4
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Sorry, I think I had where combo boxes are backwards on my intial understanding. If what you want is to change the combo box, you can create 2 different boxes, place them over one another, then show the one you want based on the radio box selected (On click).

    Code:
    Private Sub Radio Box 1_Click()
            ComboBox1.Visible = True
            ComboBox2.Visible = False
    End Sub
    
    Private Sub Radio Box 2_Click()
            ComboBox1.Visible = False
            ComboBox2.Visible = True
    End Sub
    Hope that makes sense and helps.

  5. #5
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Oh, ok. Cool. Glad I could help!

  6. #6
    GoodOmens is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    Quote Originally Posted by TG_W View Post
    Oh, ok. Cool. Glad I could help!
    Yep thanks again - one last question.

    So now it seems the After Update function is hanging a bit as it runs the query (our SQL server is slloowwww). Is there a way to "preload" each query when the form loads and have the After Update function just select the preloaded query?

    IE using the Form Load function run both the queries and save them to two separate constants and just use the After Update function to select the proper constant for my selection box?

  7. #7
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Not as far as I know. I have the same lag with my databases at work since I am using a front end and back end. Our network is slower than a car with a blown engine, so I feel your pain there.

  8. #8
    GoodOmens is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    Quote Originally Posted by TG_W View Post
    Not as far as I know. I have the same lag with my databases at work since I am using a front end and back end. Our network is slower than a car with a blown engine, so I feel your pain there.
    Ah cool. I didn't know if access/vba could save a query result to a constant.

    Anyways thanks again!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Radio Buttons
    By ccordner in forum Forms
    Replies: 1
    Last Post: 01-27-2012, 09:56 AM
  2. Radio Buttons
    By neil123williams in forum Forms
    Replies: 8
    Last Post: 11-11-2011, 03:38 PM
  3. what happened to radio buttons?
    By judomum in forum Forms
    Replies: 1
    Last Post: 10-09-2011, 11:58 AM
  4. radio buttons from 97 to 2010
    By mmm in forum Access
    Replies: 0
    Last Post: 12-03-2010, 04:20 PM
  5. option group radio buttons
    By ManC in forum Forms
    Replies: 9
    Last Post: 03-08-2010, 03:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums