I have code that I would like to set a variable in an open form from another open form. I get an error when using the code pasted below:
"Application Defined or Object Defined Error.."
Can someone tell me if you can set a variable dim'd in another form and if so what the syntax is?
Thanks..
=====================================
This part of the code is where it is erring out:
frm.str_entry_type = str_fra_val_proc_frm
I want the variable that is dim'd in the frm_pr_proc_sel_req to be set to the value of the variable in the current open form (named frm_entry_type)
=====================================
CODE:
Dim frm As Form
Set frm = Forms("frm_pr_proc_sel_req")
Dim str_msg_1 As String
Dim str_msg_2 As String
Dim str_fra_val As String
Dim str_fra_val_proc_frm As String 'for use in setting the value of the form: frm_pr_proc_sel_req varible so can decide if requester wants se or pr record..
If Me.fra_entry_type.Value = 1 Then
str_fra_val = "Profile Entry"
str_fra_val_proc_frm = "pr"
ElseIf Me.fra_entry_type.Value = 2 Then
str_fra_val = "Special Exception Entry"
str_fra_val_proc_frm = "se"
End If
str_msg_1 = "You have selected " & vbCrLf & vbCrLf & UCase(str_fra_val) & vbCrLf & vbCrLf _
& "as the Entry Type. If This is correct, click YES. Otherwise click NO and reselect"
str_msg_2 = "Please re-enter a new entry type"
If fcn_confirm(str_msg_1) = True Then
frm.str_entry_type = str_fra_val_proc_frm
DoCmd.Close
Else
MsgBox str_msg_2
Me.fra_entry_type = Null
End If
"Application Defined or Object Defined Error.."
Can someone tell me if you can set a variable dim'd in another form and if so what the syntax is?
Thanks..
=====================================
This part of the code is where it is erring out:
frm.str_entry_type = str_fra_val_proc_frm
I want the variable that is dim'd in the frm_pr_proc_sel_req to be set to the value of the variable in the current open form (named frm_entry_type)
=====================================
CODE:
Dim frm As Form
Set frm = Forms("frm_pr_proc_sel_req")
Dim str_msg_1 As String
Dim str_msg_2 As String
Dim str_fra_val As String
Dim str_fra_val_proc_frm As String 'for use in setting the value of the form: frm_pr_proc_sel_req varible so can decide if requester wants se or pr record..
If Me.fra_entry_type.Value = 1 Then
str_fra_val = "Profile Entry"
str_fra_val_proc_frm = "pr"
ElseIf Me.fra_entry_type.Value = 2 Then
str_fra_val = "Special Exception Entry"
str_fra_val_proc_frm = "se"
End If
str_msg_1 = "You have selected " & vbCrLf & vbCrLf & UCase(str_fra_val) & vbCrLf & vbCrLf _
& "as the Entry Type. If This is correct, click YES. Otherwise click NO and reselect"
str_msg_2 = "Please re-enter a new entry type"
If fcn_confirm(str_msg_1) = True Then
frm.str_entry_type = str_fra_val_proc_frm
DoCmd.Close
Else
MsgBox str_msg_2
Me.fra_entry_type = Null
End If