B
bronen
Is it possible to pass multiple values to another form without opening the
2nd form?
I have the OpenArgs procedure but it uses docmd.openform. See code below.
What can I use to avoid the openform procedure?
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
Dim stDocName As String, strArgs
Dim stLinkCriteria As String
strArgs = cboProjectNumber & "," & cboProjectName
stDocName = "Child"
If Not IsNull(cboProjectNumber) And Not IsNull(cboProjectName) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd, , strArgs
Else
MsgBox "You must fill in all values"
End If
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
------
Option Compare Database
Option Explicit
Dim arg1 As String, arg2 As String
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
Private Sub Form_Load()
If arg1 <> "" And arg2 <> "" Then
Me!ProjectNumber = arg1
Me!ProjectName = arg2
'End If
'If arg2 <> "" Then
'Not IsNull(arg2) Then
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim temp As String
temp = Nz(Me.OpenArgs)
If temp <> "" Then
arg1 = Left(temp, InStr(temp, ",") - 1)
temp = Mid(temp, InStr(temp, ",") + 1)
arg2 = Left(temp, InStr(temp, ",") - 1)
temp = Mid(temp, InStr(temp, ",") + 1)
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Error$
Resume Exit_Form_Open
End Sub
ANY help would be greatly appreciated!
Ben
2nd form?
I have the OpenArgs procedure but it uses docmd.openform. See code below.
What can I use to avoid the openform procedure?
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
Dim stDocName As String, strArgs
Dim stLinkCriteria As String
strArgs = cboProjectNumber & "," & cboProjectName
stDocName = "Child"
If Not IsNull(cboProjectNumber) And Not IsNull(cboProjectName) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd, , strArgs
Else
MsgBox "You must fill in all values"
End If
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
------
Option Compare Database
Option Explicit
Dim arg1 As String, arg2 As String
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
Private Sub Form_Load()
If arg1 <> "" And arg2 <> "" Then
Me!ProjectNumber = arg1
Me!ProjectName = arg2
'End If
'If arg2 <> "" Then
'Not IsNull(arg2) Then
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
Dim temp As String
temp = Nz(Me.OpenArgs)
If temp <> "" Then
arg1 = Left(temp, InStr(temp, ",") - 1)
temp = Mid(temp, InStr(temp, ",") + 1)
arg2 = Left(temp, InStr(temp, ",") - 1)
temp = Mid(temp, InStr(temp, ",") + 1)
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Error$
Resume Exit_Form_Open
End Sub
ANY help would be greatly appreciated!
Ben