Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Boxes (2002)

    I have the following fields: cboAccount, AccountNumber, cboCompanyName and cboContactName.
    cboAccount is populated by tblExpense-ChartOfAccounts-List. This is a two column table that has AccountNumber and Account. (These are chart of accounts expense accounts)
    On the properties box I have 0";1" with AccountNumber and Account.
    When an account is selected i.e commissions expense, AccountNumber field is filled in using =[cboAccount].[Column](0).
    cboCompanyName is populated by a query that has tblVendors-Accounts and tblVendors (one to many) with CompanyName as the first field from tblVendors and AccountNumber from tblVendors-Accounts with [cboAccountNumber] in the critera field.
    So when an expense account is selected it fills in the account number which pulls up the companies that have the account number (This is setup when the vendor is entered in another form-he is assigned an expense account. That works perfectly. Then when the company name is pulled up it in turn pulls up the contacts for that company via another querry using [cboAccountNumber] for the contacts.
    Basically in the vendors table just has company names and contacts. So ABC company has Joe then another
    record has ABC company and Bill as a contact and so forth. Probally I should have a tblContacts attached to companies but there are not many companies or contacts and I wanted to keep things simple.
    THE PROBLEM: I get occassionaly an error message that I am trying to enter text in a numeric field in cboAccount and cboContacts puts the first contact in no matter what contact is selected.
    I tried reversing the fields in cboAccounts and changing the column number in AccountNumber but then it does not work.
    Also when appended to tblChartOfAccounts-LineItems Account has 620. The number for AccountNumber.
    I used 0":1" but I guess it still posts the first field.
    Frank

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Boxes (2002)

    Frank, are those fields or controls? It is very confusing when your refer to it as a field but call it by a name that suggests a combobox control. Since controls are objects on forms and reports, rather than fields in tables, it is hard to figure out what the question really means. It may seem like a niggling difference but you'll get better answers faster if your question doesn't have to be interpreted by Loungers who might be able to help. From this quote, I take it you're actually talking about controls on a form, right?
    <hr>AccountNumber field is filled in using =[cboAccount].[Column](0)<hr>
    <hr>On the properties box I have 0";1"<hr>
    All this means is that the first column is hidden (zero inches in width) in the combobox. If you accepted the default bound column when you created the combobox, then the first column is the bound column even though you can't see it, and the 1-inch wide visible column 2 is what you see displayed. If column 1 is numeric, which is usually the case, then the actual value entered into the underlying field will be a number. If you try to insert a "0" (that is a string containing a zero) rather than a number zero, you will get an error message. Did you by any chance put "0" in the default value property of one of the comboboxes or could it be that you aren't reliably returning a numeric value from the source table for the combobox list of values?
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, CA, USA
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Boxes (2002)

    Sorry to use the wrong nomenclature. I had a table which I had defaults in AccountNumber and Account which when I copied the table for tblExpense-NonBillable it still had the defaults in them-Duh!
    Looks like it's working now. Thanks I would not have thought of that possibilty.
    What about cboContactName going always to the top record,
    Now be gentle on me.
    Frank

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Boxes (2002)

    No need to apologize. It's just easier to answer your questions when we're sure what you're talking about. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Can you expand on the problem with the combobox? Do you mean that it defaults to the first item in the list? Or are you saying that you choose one value and get another? In the latter case, I'd suggest you make the first column visible in your combobox. What I think you may find is that you have more than one item in the list with the same value in the first column. When that happens, the combobox can't really tell which one you've chosen so it displays the first match it finds. The problem then is with the list in your combobox and the logic that you're using. A combobox list has to contain unique keys in the bound column or it won't behave the way you expect it to. The values displayed in the visible column(s) are only there because they are immediately recognizable to users. The real values are the ones in the (hidden) bound column. If you confuse the combobox by including multiple instances of the same in the first column, it can't use the second column to figure out which one you meant.
    Charlotte

Posting Permissions

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