I'm trying to pass the "ADA_Member_Fac tor" variable from on form to another. The first form that puts a value in the variable is below:
---------------
The second form (which should pull up a message box with the variable, show's up nothing).
Inside the first form, the msg box properly displays the variable value. But the second form msg box is blank... I have searched several forum's and tried a few different approaches, but none have worked... Any thoughts, recommendations are greatly appreciated!
Code:
Option Compare Database
Dim ADA_Member_Factor As Double
Dim final_amount As Currency
'---------------- ^is in the General Dec's section----'
Private Sub Calc_Final_Rate_Btn_Click()
On Error GoTo Err_Calc_Final_Rate_Btn_Click
Dim db As Database
Dim ws As Workspace
Dim ADA_Member As Recordset
Dim sql As String
Dim Risk_Mgmt_Credit As Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.Databases(0)
sql = "SELECT Membership_Credit_Table.FILING_STATE, Membership_Credit_Table.Membership, Membership_Credit_Table.Membership_Rate FROM Membership_Credit_Table WHERE (((Membership_Credit_Table.FILING_STATE)='" & [Forms]![Credit_Debit_OCC_Form]![FILING_STATE] & "' ) AND ((Membership_Credit_Table.Membership)=" & [Forms]![Credit_Debit_OCC_Form]![OCC_ADA_Combo] & "));"
Set ADA_Member = db.OpenRecordset(sql)
ADA_Member_Factor = ADA_Member!Membership_Rate
MsgBox ADA_Member_Factor, vbOKOnly, "Test text"
' successfully populates msg box with the appropriate value.
Dim stDocName As String
stDocName = "Final_Rate_Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria, ADA_Member_Factor
final_amount = CDbl(Me.Base_Rate_Occ_Step3_txt) * ADA_Member_Factor
Exit_Calc_Final_Rate_Btn_Click:
Exit Sub
Err_Calc_Final_Rate_Btn_Click:
MsgBox Err.Description
Resume Exit_Calc_Final_Rate_Btn_Click
End Sub
The second form (which should pull up a message box with the variable, show's up nothing).
Code:
Option Compare Database
'-----------^in the General Dec's section-----------'
Private Sub Form_Load()
MsgBox Forms!Credit_Debit_OCC_Form.ADA_Member_Factor, vbOKOnly, "Test text"
End Sub
Comment