Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box (Access 97)

    I have a combo box and a label. In a table i have the values that are in the combo box. Also in the table with the values, there are descriptions of the values. When i pick a value form the combo box, i want the label to automatically be filled in with the description of the value from the table. I only want about the first 8 characters of the description. Any help?

    Thanks,
    Nick

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

    Re: Combo Box (Access 97)

    Set the Column Count property of the combo box to 2.
    Set the Column Widths property of the combo box to 1";0".
    If the value and the description are the first two columns in the table, set the Row Source property of the combo box to the table, otherwise, set it to a query or SQL statement that return the value and description fields.

    If you want to use a label, write code in the After Update event of the combo box:

    Private Sub MyCombo_AfterUpdate()
    Me.MyLabel.Caption = Me.MyCombo.Column(1)
    End Sub

    If you only want the first 8 characters, use Left(Me.MyCombo.Column(1), 8)

    You can also use a text box instead of a label. Make it look like a label, set its Locked property to Yes and its Enabled property to No, and set its Control Source to
    =[MyCombo].[Column](1)

    Substitute the correct names for the label and combo box.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (Access 97)

    I have a problem similar to dubbs only my text box in on a report. My text box is called txtBox bound to field called Info from a query. I only want the first 5 characters of Info to display.

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

    Re: Combo Box (Access 97)

    Set the Control Source of txtBox to

    <code>=Left([Info],5)</code>

  5. #5
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (Access 97)

    I have posted the database I am working with. I have two small problems. Open the Print report and input A170 as emp name, 1 as week#, 2004 as year. The problem is it keeps asking me for a Job# parameter. I don't know why it wants this. If you leave it null and select OK, it doesn't matter. If you input somthing, it doesn't do anything with it.
    The other problem relates to my prior post. I only want the left five character of Billing Code to show. If I put left... in the control source, I get a syntax error.
    Thanks for your input.

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

    Re: Combo Box (Access 97)

    The record source of the report is based on a linked table from another database, so I can't do anything with it. You must either import the table instead of linking it, or you must post the other database too.

  7. #7
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (Access 97)

    Here is the same thing only it includes tblJob#.

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

    Re: Combo Box (Access 97)

    The query expects a table tblJobNumbers but there was only a tblJobNumbers1. I have renamed it in the hope that is correct.

    You report is sorted by a non-existing field Job# in the Sorting and Grouping window. This is the cause of the prompt for Job#. Remove it from the Sorting and Grouping window to get rid of the prompt.

    Further testing is impossible since the job number for the parameters you suggested is not available in tblJobnumbers.

  9. #9
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (Access 97)

    When I put left([Billing Code],5) as the control source of my text box, it gives me a syntax error saying syntax error comma in query or expression. Any suggestions?

  10. #10
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (Access 97)

    Never mind... I just added left([field],n) as and expression in the query and bound the text box to that.

Posting Permissions

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