none
Send value of Combo box from FormA to FormB RRS feed

  • Question

  • Hi,

    I have read countless support posts on numerous websites and had a thorough search through here as well, but cannot find a solution to this problem.

    I am using MS Access 2007.

    I am trying to take the selected vaue for 2 combo boxes "cmbSDA" and "cmbSSDA" and write this in to 2 text boxes on another form when the "go" button is pressed.

    FormA = frm_Pick_CallType
    FormB = frm_Standard_Call_Monitor

    2 combo boxes on FormA are cmbSDA and cmbSSDA
    2 text boxes on FormB are txtSDA and txtSSDA

    I used Global variables within a Module called "Global Variables" so I could assign the values to a variable and then use that (I understand this is not necessary...)

    Anyway... here is the code:

    Private Sub cmdGo_Click()
    Dim calltype As String

    calltype = cmbCalltype.Value
    strSDA = Me.cmbSDA
    strSSDA = Me.cmbSSDA
    If Not IsNull(Me.cmbSDA) Then
    GoTo exeGo:
    End If
    exeGo:
    If calltype = "Standard Call" Then
        DoCmd.OpenForm "frm_Standard_Call_Monitor"
        Forms("frm_Standard_Call_Monitor")!txtSDA.Value = strSDA
        Forms("frm_Standard_Call_Monitor")!txtSSDA.Value = strSSDA
    'If calltype = "Standard call (password reset)" Then
        'DoCmd.OpenForm "frm_Standard_Call_Reset_Monitor"
    'If calltype = "Chase call" Then
       'DoCmd.OpenForm "frm_Chase_Call_Monitor"
    'End If
    'End If
    End If
    Exit Sub


    DoCmd.Close acForm, "frm_Pick_CallType"

    End Sub

    The 2 underlined parts of the code are the parts that do not work....(ignore the other quoted out lines)

    I have tried different referencing methods, I have tried using Form_Load on FormB then assigning the Global variables to the text boxes, but still cannot get this to work... can someone please be so kind as to solve this problem for me?

    Rather ironically, this did work at one point, but can't see what has changed to stop this from working.  All spelling appears to be correct, so not a simple syntax error from what I can see.

    Kind Regards

    Wednesday, December 28, 2011 11:51 AM

Answers

  • On which form do you run the code?

    When referencing to Form B, the Form B needs to be open.

     

    Hope this helps,

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Friday, January 20, 2012 6:09 AM
    Moderator

All replies

  • Apologies -- those 2 lines should actually read -->
    "
        Forms!frm_Standard_Call_Monitor!txtSDA.Value = strSDA
        Forms!frm_Standard_Call_Monitor!txtSSDA.Value = strSSDA
    "

    I was playing around with different formatting - needless to say -without success.

    Error is
    "Run-time error '40036':

    Method 'Item' of object 'Forms' failed"


    • Edited by KickAssDave Wednesday, December 28, 2011 11:58 AM
    Wednesday, December 28, 2011 11:55 AM
  • On which form do you run the code?

    When referencing to Form B, the Form B needs to be open.

     

    Hope this helps,

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Friday, January 20, 2012 6:09 AM
    Moderator
  • Hi KickAddDave,

     

    How about the problem on your side?

     

    Do you still need any assistant about the problem?

    If you still show any concern on the problem, just feel free to let us know.

     
    Best Regards,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Friday, January 27, 2012 7:42 PM
    Moderator