So I have a search form that I created that has also a subform (a continous form, that has a query as its source) where my records are listed. I started on making a Between dates filter where i would be able to pick dates and get the results of records that are in that range.
I put two text boxes in which I set format to Short Date so that I get the button to select the date from a calendar for each text box. Then I made a button that is only for this and added a Clickon code so that it filters my subform over the recordsource of the form. The problem is is that i get an error and it doesnt filter
If anyone knows how to fix this or has a better idea. please do tell
Code is:
I put two text boxes in which I set format to Short Date so that I get the button to select the date from a calendar for each text box. Then I made a button that is only for this and added a Clickon code so that it filters my subform over the recordsource of the form. The problem is is that i get an error and it doesnt filter
If anyone knows how to fix this or has a better idea. please do tell
Code is:
Code:
Private Sub btnDatumUpis_Click()
Dim SQL As String
SQL = "SELECT qrySearchV.VID, qrySearchV.MarkVoz, qrySearchV.ModelVoz, " _
& "qrySearchV.TipMot, qrySearchV.Regist, qrySearchV.VlaVoz, " _
& "qrySearchV.KorVoz, qrySearchV.KatV, qrySearchV.DatumUVoz, " _
& "qrySearchV.BrojS, qrySearchV.VrsPog, qrySearchV.VrsGo " _
& "FROM qrySearchV " _
& "WHERE DatumUVoz [B]BETWEEN #" & Me.txtOdDatum & "# AND #" & Me.txtDoDatum & "#[/B] " _
& "ORDER BY qrySearchV.MarkVoz"
Me.subPretrVoz.Form.RecordSource = SQL
Me.subPretrVoz.Form.Requery
End Sub