Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62

    Unanswered: newbie Q's about pulling info from 2 tables

    Hello all,
    I have a form with two options in a combo box, what i want to do is inthe next combo box in line if the first box =1 then load from list 1, but if the answer is 2 then load from list two. But in the same combo i was thinking something like
    If[class]=1 then SELECT Visit_type_med.visit_type_med FROM Visit_type_med;

    Where class is the name of the first combo

    I'm sure this is way off base but i'm new and swinging in the dark.
    Thanks in advance

    Brownie

  2. #2
    Join Date
    Sep 2003
    Posts
    228
    Using VBA is the way to go here...
    Code:
    If Me.Combo0.Value = 1 Then
        Me.Combo2.RowSource = YOUR SQL STATEMENT
    Else
        Me.Combo2.RowSource = YOUR OTHER SQL STATEMENT
    End If
    Make sure the RowSourceType is set to "Table/Query"

  3. #3
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62
    Thats it,
    Thanks Ottomatic

  4. #4
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62

    Having problems this a.m

    Tryied this today and am not sure how to put this together
    Please look at the zip and shed some light, (agin i just started vb about 3 weeks ago and am trying to catch up)
    The box named vc is where the dewsisin 1,2 is made
    box vis_type is the target
    and i'm pulling from visit_type_med and visit_type_psyc
    if you can get me started i'm sure i can figure this out
    thanks in advance
    Brownie
    Attached Files Attached Files
    Last edited by Brownie13; 10-14-04 at 09:59.

  5. #5
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62

    Sorry, double posted and can't delete

    Sorry, double posted and can't delete
    Last edited by Brownie13; 10-14-04 at 09:50.

  6. #6
    Join Date
    Sep 2003
    Posts
    228
    OK... I added a little code to select the record source for the second combo box based on the first combo boxes value. Your tables had ID fields that were not populated, you should use Autonumber if the ID is not going to be visible. Also, you should really have a seperate column for the the numbers and not include them with the string. In your second combo box I had to change the column count to 2 so the string would show up (column 1 I made 0 width).

    Another note, you have many tables with the same data...
    vist_type_med and visit_type_psyc could be one table with additional column named 'Type'. Then your record source's could be something along the lines of:
    Code:
    SELECT "Reason" FROM "Visit_Type" WHERE "[Type] = ""Med""
    SELECT "Reason" FROM "Visit_Type" WHERE "[Type] = ""Psyc""
    see attatchment
    Attached Files Attached Files

  7. #7
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62

    ottomatic to the rescue, Again

    Thanks alot mate,
    Someday i'll be able to payback someone who is clueless, with a bit of knowledge, and the cycle continues.
    Again thanks for the support
    Brownie

Posting Permissions

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