Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    combining variables (access 2000)

    ok well i have two seperate combo boxes in my form box to seek for A. first name and B last name. unfortunately there is multiples of first names and people with the same last name within the database making it difficult to bring up the specified form. I was wondering how i might be able to make it so that i can at least bring up the mutiples of A or B in the form to scroll through.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: combining variables (access 2000)

    Without knowing how your forms and tables are set up it's hard to give a specific answer. If you want to open another form form the form with the combobox, use something like this (substitute the appropriate names):

    DoCmd.OpenForm FormName:="frmOtherForm", WhereCondition:="[FirstName]=" & Chr(34) & Me.[ComboA] & Chr(34) & " And [LastName]=" & Chr(34) & Me.[ComboB] & Chr(34)

    The occurrences of Chr(34) surround the string values of first name and last name with double quotes. This instruction will open frmOtherForm and display only the records whose first name and last name match the values selected in the combo boxes.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: combining variables (access 2000)

    Another option is to just have one combo box that displays a concatenation of both names.

    In the query that provides the data, create a calculated field Name: [surname] & " " & [firstname].
    Regards
    John



  4. #4
    New Lounger
    Join Date
    Feb 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combining variables (access 2000)

    ok well i have a set table with names and addresses and general information. every individual has a form to themselves and in which each form has a pair of combo boxs set to find a value on a form based on a value i typed in the form box, one form box searches the field (first name) and the second (last name). these combo boxes in the form are so that the user can pull up the information of that person. like i said before i am having difficulty with this because i can pull either or but sometimes when there is a multiple of either the first or last name - such as i was using the combo box used to pull up a form using a last name i might get a persons form with the same last name, but am unable to pull up that specific file. the same goes for the combo box set up to open. like if i was looking for bob smith and it would pull up joe smith who has the same last name. and what was that code? I am teaching myself this program as i go and was unfamiliar with it.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: combining variables (access 2000)

    You don't make it easy for us mere mortals to understand you, oh Moon God <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

    I recommend that you go with John Hutchison's suggestion. I will try to give some details. I will use FirstName and LastName as field names. Replace them by the names you have in what follows below.

    First, in the database window, click on Queries on the left-hand side.
    Double-click New Query in Design View.
    Add the table containing the names, then close the Display Table window.
    Double-click the first item in the list of fields. This will add <tablename>.* to the query grid.
    In the first empty column, enter <font face="Georgia">FullName:[FirstName]&" "&[LastName]</font face=georgia>
    Close the query and reply Yes when asked if you want to save it. Name it (for instance) qryNames.
    It is a good idea to double click the query now to see if the full name is displayed correctly.
    After closing it, click Forms in the left hand side of the database window.
    Open your form in design view.
    Delete the two combo boxes you have.
    Activate the Properties window (if it isn't open, select View/Properties)
    Select the Data tab.
    Set the Record Source property to the name of the query you just made.
    If the Toolbox is not displayed, select View/Toolbox
    Make sure that the Control Wizard (the "Magic Wand" button on the Toolbox) is "on".
    Add a new combo box to the form.
    The Combo Box Wizard appears.
    In the first step, select the third option (Find a record based on the value of the combo box.)
    In the second step, select FullName and move it to the list on the right.
    In the third step, adjust the column width if necessary.
    In the fourth step, specify a caption (or accept the proposed caption) and click Finish.
    Close and save the form, then open it in form view.
    You should now be able to select a record based on the combination of first and last name.

  6. #6
    New Lounger
    Join Date
    Feb 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: combining variables (access 2000)

    thank you all very much,

Posting Permissions

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