T
Tony Williams
I have a form that has a combo box to select a month. The name of the combo
box is txtmontha (I realise it would have been better to name it cmb???) The
is a command button that when clicked should open a form where the date
selected from the combo box is the same value as the date on the form. Here
is the code behind the command button:
Private Sub cmdopenrecord_Click()
On Error GoTo Err_cmdopenrecord_Click
Dim strqtr As String
strqtr = Me.txtmontha.Value
Forms!frmMain!SubForm1.SourceObject = "frmFDA"
Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [qrysearch]
WHERE [txtmonthlabel] = strqtr"
Exit_cmdopenrecord_Click:
Exit Sub
Err_cmdopenrecord_Click:
MsgBox Err.Description
Resume Exit_cmdopenrecord_Click
End Sub
Both the combox and the control on the form are formatted as mmmm yyyy.
However when I click the command button the form opens but I get a message
box that asks for the value of strqtr.
Can someone help me with this problem please?
Thanks
Tony
box is txtmontha (I realise it would have been better to name it cmb???) The
is a command button that when clicked should open a form where the date
selected from the combo box is the same value as the date on the form. Here
is the code behind the command button:
Private Sub cmdopenrecord_Click()
On Error GoTo Err_cmdopenrecord_Click
Dim strqtr As String
strqtr = Me.txtmontha.Value
Forms!frmMain!SubForm1.SourceObject = "frmFDA"
Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [qrysearch]
WHERE [txtmonthlabel] = strqtr"
Exit_cmdopenrecord_Click:
Exit Sub
Err_cmdopenrecord_Click:
MsgBox Err.Description
Resume Exit_cmdopenrecord_Click
End Sub
Both the combox and the control on the form are formatted as mmmm yyyy.
However when I click the command button the form opens but I get a message
box that asks for the value of strqtr.
Can someone help me with this problem please?
Thanks
Tony