I have a form (frmCMReport) with two text fields (txtCMStartDate, txtCMEndDate) and a button.
Code when you click the button:
Private Sub cmdRunReport_Click()
Dim retVal As Integer
Dim myStr As String
myStr = "start: "
myStr = myStr & frmCMReport.txtCMStartDate.Text ' error line
myStr = myStr & ", end: "
myStr = myStr & frmCMReport.txtCMEndDate.Text
myStr = myStr & "."
retVal = MsgBox(myStr, vbOKOnly)
(It's just simple code to display the values as I want to know how to access the field values. Doing stuff with them comes later.)
Right now when I run the code I get "Error 424 Object Required". If I change the error line to "myStr = myStr & Form_frmCMReport.txtCMStartDate.Text" I get "Error 2185 You can't reference a property or method for a control unless the control has the focus".
This should be a simple thing to do, so how do I do it?