Consulting

Results 1 to 2 of 2

Thread: VBA form not passing values

  1. #1
    VBAX Regular
    Joined
    Jan 2017
    Location
    Hudson
    Posts
    11
    Location

    VBA form not passing values

    Hi All, first post in a while, I've been really busy.

    I'm missing something simple with an Access project.

    I have two forms. I am attempting to pass two pieces of data from the main form to the new pop up form. The code looks right and I'm either missing something on the delivery or the deployment, but whichever it is, the correct information is not populating.

    On the signoff form I need two vital parts of information. The Logpg and the tail number or reg in this case. Clicking on the 8130 button is supposed to copy both pieces and deliver them to the new open form. I can get the form to open but it won't pass the data

    'This is from the sign off form
    Private Sub btn_8130_Click()
     
    Dim lp As String
    Dim reg As String
    
    lp = Me.Logpg.Value
    reg = Me.tail.Value
    
    DoCmd.OpenForm "frm_8130", acNormal, , , acFormAdd, acWindowNormal, "lp ; reg"
    
    End Sub
    
    
    'This is the second form that is opened
    
    Private Sub Form_Load(Canel As Integer)
    
    
    Dim Args As String
    
    
    If Not IsNull(Me.OpenArgs) Then
        Args = Split(Me.OpenArgs, ";")
        Me.Logpg = argstrg(0) 'This should be the log page passed from the sign-off form
        Me.reg = argstrg(1) 'This should be the tail number passed from the sign 0ff form
    End If
    
    
    End Sub
    I'm not sure what I'm doing wrong and would appreciate and direction anyone can throw me.

    Thanks

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    To pass data using a variable you should declare the variable as a "Public variable".
    Create a Module and add a line like this using your variables

    Public myuserid As Integer

    That will allow those variables to be used anywhere in the database.

Tags for this Thread

Posting Permissions

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