Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA code for combobox column (2007)

    I have a combo box on frmMain. The control source for the box is:

    SELECT tblPO.[PO#], tblPO.[Job Number], tblJobNumbersLoc.[Customer Name]
    FROM tblPO INNER JOIN tblJobNumbersLoc ON tblPO.[Job Number] = tblJobNumbersLoc.[Job Number];

    On a differet form, on the form load event, i want to set a text box to column 1 of the combo box.

    Why doens't this statement work?
    Me.txtPO.Value = [Forms]![frmMain]![cmbSelectPO]

    When the other form opens, I get a message box asking me to input a value for cmbSelectPO. I tried adding [column](1) after the cmbselectpo, but that didn't work.

    Thanks,

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

    Re: VBA code for combobox column (2007)

    I assume that the SQL statement you posted is the Row Source of the combo box, not the Control Source.

    Is frmMain open when you open the other form? You can't refer to controls on a form that isn't open.
    If frmMain is open, check carefully that the spelling of frmMain and cmbSelectPO is correct (even a space in front of the name would throw Access off)

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA code for combobox column (2007)

    I was closing the form before I opened the next form. I changed it to open the new form and then close frmMain and now it works.
    Thanks,

Posting Permissions

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