• Visible/Invisible text boxes (2K & XP)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Visible/Invisible text boxes (2K & XP)

    Author
    Topic
    #383558

    I’m not entirely sure if I follow the problem, but are you trying to “lookup” these values?

    If so, can you use a combo box that looks up a primary key value but displays the concatenated name? The source of the combo box would be a query that does the concatenation? If necessary, the combo box could have all the fields separately for lookup purposes and a display field that is concatenated?

    HTH,

    Viewing 0 reply threads
    Author
    Replies
    • #654520

      (Edited by charlotte on 18-Feb-03 19:58. to activate link to post)

      I’m trying to adapt an idea I found in post # 208581, where BobB passed on code from John Viescas. The code uses Select Case to manipulate the visible property of a pair of text boxes. I have a table to store information about businesses and individuals who’ve donated to a fund-raiser. I want to distinguish between business-type donors and private individuals, so I have a lookup field for “Business” and “Individual.” Next comes a field named “DonorBusinessName.” Next I identify individuals, and that’s where my trouble begins.

      I have fields such as “DonorTitle” (Mr., Dr., Ms.), “DonorFName,” “DonorLName,” and so on. A query for donors includes an expression that concatenates the elements of an individual donor’s name. The expression works fine in the query, but I get into trouble in the form that I wrote next.

      The form gets its data from the query. The user first selects donor type. Then I have two fields whose Visible property is set to No. The first “not visible” field is “DonorBusinessName”‘; the second is supposed to come from that expression for individual donor’s name. I wrote the select case stuff to make visible one or the other of these fields depending on the value of the User Type field. You who’ve earned your degree in Access no doubt could have told me that such a scheme will not work with an expression. Access tells me an expression can’t be edited, so it won’t work the way I intended.

      If this were your project, how would you approach this? The form should allow a user who’s unschooled in Access to feed data into a catalog. I don’t want the user to have to spend more than a few seconds to match the correct donor with an item. I already have a list of about 100 donors (gleaned from last year’s event). Suppose Hank’s Car Wash steps up to donate to this year’s event. The user now enters the new item in this year’s catalog. She tabs through the form and gets to the field for donor type. She selects “Business.” She tabs again to the donor name combo box, which drops open as soon as it gets the focus. She keys in “H-a” and finds Hank’s Car Wash. If the donor is an individual, however, I’d have to give the user a combo box that displays separate fields for the various elements of the name…unless, of course, there’s a way to display a concatenated form of the name.

      • #654673

        Is the user selecting a type of donor first? If so, you could use two subforms with different controls depending on whether the donor was a person or a business. Then just set the visible property of the appropriate subform to true and the other to false.

        Don’t try to bind your controls to expressions because as you have discovered, controls bound to expressions can’t be edited. Nor do they need to be. Each field that goes into the donor name has to be entered somewhere. If this is where it gets entered, then you need to have the individual controls bound to the individual fields so the data can be entered. If, on the other hand, your donor name gets entered into a donors table and you just want the user to select a donor from the list, then all you need to bind the combobox to is the field that holds that donor ID in your donations table. The donors table should have a unique ID for each donor, not their name or social security number, just a uniqueID, and that should be the value that is bound to the field in your donations table. It doesn’t have to be visible in your combobox because you can set that column’s width to zero and only display a concatenated name if you wish.

    Viewing 0 reply threads
    Reply To: Visible/Invisible text boxes (2K & XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: