Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    79

    Unanswered: TextBox Another Routine

    I have a subroutine that detects information selected in a combo box. I can do a msgbox at the end of this routine and see the stored value, however, when attempting to call another subroutine, the value is lost. Any help will be greatly appreciated.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    What is the 'other' sub routine doing? is it assigning a value to the combo box
    is the combo box bound, if so is it possible you are moving the record pointer as part of the 'other' sub routine.

    Once selected the value should stay in the combo.

  3. #3
    Join Date
    Nov 2005
    Posts
    79
    The other subroutine is not assigning any information to the combo box. The second routine is passing header information to a report.

    There is a parameter([type]) that is obtained through the first form from the ComboBox. Because the information in the combo box does not pass from one subroutine to the other, I am prompted for a "type"

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Combo Box

    I'd check your columns in the combo box (i.e. Column Count and BOUND COLUMN). If you're passing a value from the after_update on the column box, maybe debug or do a msgbox on what value is being passed to the other sub-routine (is it being passed as a variant, string, or integer?). If the value is returned correctly in the first routine, then something must be wrong in the translation to the other sub-routine.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2005
    Posts
    79

    Text Box

    At this point, cmdCombo is "Blackberry"
    Next cmdTest is then "Blackberry"

    cmdTest = cmdCombo
    DoCmd.OpenQuery "Run Report2 Query", acViewNormal, acEdit
    MsgBox cmdTest
    DoCmd.OpenReport "Compilation Report ", acViewPreview, , , , strReportName




    After the opening of the report, undefined

    Private Sub Report_Open(Cancel As Integer)
    'Pass the title to the report

    MsgBox cmdTest

    cmdTest no longer has a value

  6. #6
    Join Date
    May 2004
    Posts
    65

    Try

    Private Sub Report_Open(Cancel As Integer)
    'Pass the title to the report

    MsgBox Forms!FormName!cmdCombo

    'That will look up the field value in the form
    'you could then do the next part here

    tempval = Forms!FormName!cmdCombo

    'now do whatever you want with tempval

Posting Permissions

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