What is wrong with this code? I know it something basic, but I cannot figure it out? I am just trying to figure out how to pass a field value from one form to another. In this case when the button for TestForm0 is clicked, the program opens up TestForm1. I am trying to get TestForm1 to display a Public Variable (FieldA) that was set in TestForm0. What am I doing wrong???
Any help or ideas would be greatly appreciated! Thanks!
TestForm0
TestForm1
Any help or ideas would be greatly appreciated! Thanks!
TestForm0
Code:
Option Compare Database
Option Explicit
Public FieldA As String
Private Sub CmdBtnFieldA_Click()
On Error GoTo Err_CmdBtnFieldA_Click
Dim stDocName As String
Dim stLinkCriteria As String
FieldA = "test"
stDocName = "TestForm1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdBtnFieldA_Click:
Exit Sub
Err_CmdBtnFieldA_Click:
MsgBox Err.Description
Resume Exit_CmdBtnFieldA_Click
End Sub
TestForm1
Code:
Option Compare Database
Option Explicit
Private Sub Form_Load()
Me.txtFieldA = FieldA
End Sub