rikklaney1
Registered User.
- Local time
- Yesterday, 23:20
- Joined
- Nov 20, 2014
- Messages
- 157
I have a report that shows on a form and has this as the recordset
SELECT [ClnTbl-RS5].SCdate, [ClnTbl-RS5].[act1-1], [ClnTbl-RS5].[act2-1], [ClnTbl-RS5].[act3-1], [ClnTbl-RS5].[act4-1], [ClnTbl-RS5].[Cletime-1], [ClnTbl-RS5].[Tigtime-1], [ClnTbl-RS5].[Tottime-1], [ClnTbl-RS5].[Operator-1] FROM [ClnTbl-RS5] WHERE ((([ClnTbl-RS5].SCdate)=DateAdd('d',-22,Date())));
I can put that in the on open event of a form like this
'Me.Report1.Report.RecordSource = "SELECT [ClnTbl-RS5].SCdate, [ClnTbl-RS5].[act1-1], [ClnTbl-RS5].[act2-1], [ClnTbl-RS5].[act3-1], [ClnTbl-RS5].[act4-1], [ClnTbl-RS5].[Cletime-1], [ClnTbl-RS5].[Tigtime-1], [ClnTbl-RS5].[Tottime-1], [ClnTbl-RS5].[Operator-1] FROM [ClnTbl-RS5] WHERE ((([ClnTbl-RS5].SCdate)=DateAdd('d',-22,Date())));"
now my question is if I have a text box with a value of something other than ClnTbl-Rs5, can I use the same report but have the vba change depending on my text box? Like this
'Me.Report1.Report.RecordSource = "SELECT [Me.Tablename.value].SCdate, [Me.Tablename.value].[act1-1], [Me.Tablename.value].[act2-1], [Me.Tablename.value].[act3-1], etc...
SELECT [ClnTbl-RS5].SCdate, [ClnTbl-RS5].[act1-1], [ClnTbl-RS5].[act2-1], [ClnTbl-RS5].[act3-1], [ClnTbl-RS5].[act4-1], [ClnTbl-RS5].[Cletime-1], [ClnTbl-RS5].[Tigtime-1], [ClnTbl-RS5].[Tottime-1], [ClnTbl-RS5].[Operator-1] FROM [ClnTbl-RS5] WHERE ((([ClnTbl-RS5].SCdate)=DateAdd('d',-22,Date())));
I can put that in the on open event of a form like this
'Me.Report1.Report.RecordSource = "SELECT [ClnTbl-RS5].SCdate, [ClnTbl-RS5].[act1-1], [ClnTbl-RS5].[act2-1], [ClnTbl-RS5].[act3-1], [ClnTbl-RS5].[act4-1], [ClnTbl-RS5].[Cletime-1], [ClnTbl-RS5].[Tigtime-1], [ClnTbl-RS5].[Tottime-1], [ClnTbl-RS5].[Operator-1] FROM [ClnTbl-RS5] WHERE ((([ClnTbl-RS5].SCdate)=DateAdd('d',-22,Date())));"
now my question is if I have a text box with a value of something other than ClnTbl-Rs5, can I use the same report but have the vba change depending on my text box? Like this
'Me.Report1.Report.RecordSource = "SELECT [Me.Tablename.value].SCdate, [Me.Tablename.value].[act1-1], [Me.Tablename.value].[act2-1], [Me.Tablename.value].[act3-1], etc...