Professional Web Applications Themes

combo box dilemma - Microsoft Access

I placed a posting awhile back and recvd a response that got me going (thanks Fred). But in doing so, I ran into a further snag. So I am posting it again since the other is back a bit. Needless to say I was a bit hasty in saying it worked. I have a form that has a combobox on it from which clients can be selected from. The clients have client codes assigned to them. All the forms are filterd based on the client code. There are numerous forms requiring numerous buttons (actually another form to hold them all). ...

  1. #1

    Default combo box dilemma

    I placed a posting awhile back and recvd a response that
    got me going (thanks Fred). But in doing so, I ran into
    a further snag. So I am posting it again since the other
    is back a bit. Needless to say I was a bit hasty in
    saying it worked.
    I have a form that has a combobox on it from which
    clients can be selected from. The clients have client
    codes assigned to them. All the forms are filterd based
    on the client code. There are numerous forms requiring
    numerous buttons (actually another form to hold them
    all). Currently there is a macro to the buttons that
    opens up the form and filters it with the following in
    the macro WHERE line. It is [ClientCode]=Forms!
    [usrfrmClientSelection]![ClientCode]. Now, the division
    asking for this Access database is requesting a few more
    forms to be added. The number of buttons is getting more
    then it should be. I would like to offer a different
    method of opening the forms.
    I would like to use a combo on the Client Selection form
    that lists out the form names for the user to select
    from. Thanks to Fred I have in the click event of the
    combo the following;

    DoCmd. OpenForm comboboxname, acNormal,,[ClientCode]=
    [Forms]![usrfrmClientSelection]![ClientCode].

    There remainder is all default and so it isn't needed.
    The form opens up but is not filtered. This is the
    stumbling block I have encountered.
    Any assistance is appreciated.
    *** John

    John Guest

  2. #2

    Default combo box dilemma

    If I read this correctly, you want to open a form by
    choosing it's name from a combo box?

    If that's the case then, here is one possible solution:

    Create the combo box and in the data field use:

    SELECT MSysObjects.Name, MSysObjects.Type
    FROM MSysObjects
    WHERE (((MSysObjects.Type)=-32768));

    as the SQL statement. This will give you a combo box
    with all of your form names in the database. Then, on the
    AfterUpdate event of the combo box, write this code:

    Dim strFormName as String
    strFormName = Me.ComboBox.Value
    DoCmd.OpenForm strFormName

    This will open the form.

    If you have additional forms in your database that you do
    not want to show up in the combo box, you could make a
    query in design view and customize the criteria to find
    only the forms you want.

    Example: Use a uniform naming convention for the forms
    that your users will access from the combo box (usrForm1,
    usrForm2, etc.) In the Name field of the MSysObjects
    table, write criteria: Like "usr" & "*"

    This will return all of the forms that have that prefix.
    You'd use the same code on the combo box in this
    situation.

    Hope this helps,
    Crystal

    Crystal Guest

  3. #3

    Default combo box dilemma

    Crystal, I got the filter part to work. I added it as
    part of the DoCmd line. This is beginning to work good.
    Thanks for the help on this.
    Just so you know why I was trying to get this one of the
    divisions asked for this db and wanted all of the
    processes separated out so each has its own form.
    They've been giving me the process in chuncks. I'm at 31
    forms so far with (and I'm guessing) at least that many
    more to go. That's not counting the "popups" they want.
    So you can see, the standard button method could be a bit
    bersome by the time this all comes together. Oh well,
    if that's what they want, that's what they'll get.
    *** John

    >-----Original Message-----
    >If I read this correctly, you want to open a form by
    >choosing it's name from a combo box?
    >
    >If that's the case then, here is one possible solution:
    >
    >Create the combo box and in the data field use:
    >
    >SELECT MSysObjects.Name, MSysObjects.Type
    >FROM MSysObjects
    >WHERE (((MSysObjects.Type)=-32768));
    >
    >as the SQL statement. This will give you a combo box
    >with all of your form names in the database. Then, on
    the
    >AfterUpdate event of the combo box, write this code:
    >
    >Dim strFormName as String
    >strFormName = Me.ComboBox.Value
    >DoCmd.OpenForm strFormName
    >
    >This will open the form.
    >
    >If you have additional forms in your database that you
    do
    >not want to show up in the combo box, you could make a
    >query in design view and customize the criteria to find
    >only the forms you want.
    >
    >Example: Use a uniform naming convention for the forms
    >that your users will access from the combo box
    (usrForm1,
    >usrForm2, etc.) In the Name field of the MSysObjects
    >table, write criteria: Like "usr" & "*"
    >
    >This will return all of the forms that have that prefix.
    >You'd use the same code on the combo box in this
    >situation.
    >
    >Hope this helps,
    >Crystal
    >
    >.
    >
    John Guest

Similar Threads

  1. flash player dilemma
    By red.eevie in forum Macromedia Flash Player
    Replies: 1
    Last Post: May 5th, 06:27 PM
  2. my FLV playback dilemma...it stutters...Please help
    By kamoue in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: February 20th, 11:41 AM
  3. An Old-Timerís Dilemma With Acrobat/FrameMaker
    By Fred_Tabbutt@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 3
    Last Post: December 9th, 02:59 AM
  4. (simple?) query dilemma--help please
    By Bosconian in forum MySQL
    Replies: 2
    Last Post: November 19th, 02:00 AM
  5. WSDL Dilemma
    By Demetri in forum ASP.NET Web Services
    Replies: 1
    Last Post: November 29th, 08:55 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139