T
Tony Williams
I have a form which has a control called txtmontha and a command button that
opens another form when the value of txtmontha is equal to a field
txtmonthlabel in a table tblmaintabs. I want to add another control as a
combo box on my form where the user can select a company name. so that the
value of the combo box (cmbselectcompany)equals a specific company
(txtcompany) in the table as well as the month. However if the combox is
blank ie the user doesn't select a company, I want all the records shown on
my destination form for the selected month.
How do I adapt this statement to include whether or not the user selects a
company?
Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [tblmaintabs]
WHERE [txtmonthlabel] = #" & Format(strtxtdate, "mmmm/yyyy") & "#;"
Thanks
Tony
opens another form when the value of txtmontha is equal to a field
txtmonthlabel in a table tblmaintabs. I want to add another control as a
combo box on my form where the user can select a company name. so that the
value of the combo box (cmbselectcompany)equals a specific company
(txtcompany) in the table as well as the month. However if the combox is
blank ie the user doesn't select a company, I want all the records shown on
my destination form for the selected month.
How do I adapt this statement to include whether or not the user selects a
company?
Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [tblmaintabs]
WHERE [txtmonthlabel] = #" & Format(strtxtdate, "mmmm/yyyy") & "#;"
Thanks
Tony