How to search a month range from MS Access and display the result in VB data report. For example i want to search all the records from the month of April and it will display the results in VB data report.
Please help me...
Printable View
How to search a month range from MS Access and display the result in VB data report. For example i want to search all the records from the month of April and it will display the results in VB data report.
Please help me...
you can let hte user to input two dates (you can use datetime picker) then in your SQL:
of course, date1 and date2 are dates coming from your date time pickers ;)Quote:
.... WHERE DateField Between 'date1' AND 'date2'
Sorry eimroda but i'm new to all this. Can you please give me an example.
Thanks alot hope you can help me.
are you using the data environment?
Yes i'm using data environment. Can i search the date range and display it in data report? Previously i wanted to display the search result to MSFlexGrid then to data report but fail. Hope you can help me.
Please i need help urgently. I only have less than 24 hours to my final presentation.
wait... i'll make a sample project for you...;)
dont know if this will help but i loop though my records to search for a name enterd by the user
VB Code:
Private Sub txtSearch_KeyDown(KeyCode As Integer, Shift As Integer) 'Search database for a client Dim MSG, Style, Title, Response Dim i As Integer If KeyCode = 13 Then 'Enter button If txtSearch.Text = "" Then MsgBox "Please enter a client's name to search for", vbInformation, "Search Results" txtSearch.SetFocus Exit Sub End If Else: Exit Sub End If txtSearch_Validate True 'Got to the sub to validate text input dtaClients.Recordset.MoveLast dtaClients.Recordset.MoveFirst For i = 0 To dtaClients.Recordset.RecordCount - 1 If dtaClients.Recordset.Fields("Name") = txtSearch.Text Then txtSearch.Text = "" txtSearch.Visible = False Exit For ElseIf dtaClients.Recordset.RecordCount - 1 = i Then MSG = "No match found! Please check name is spelled correctly" & _ vbCrLf & vbCrLf & "Would you like to create a new search?" Style = vbYesNo + vbInformation Title = "Search Results" Response = MsgBox(MSG, Style, Title) If Response = vbYes Then txtSearch_Validate False txtSearch.SetFocus Else: txtSearch.Text = "" txtSearch_Validate False txtSearch.Visible = False End If Else: dtaClients.Recordset.MoveNext End If Next i End Sub
if i helped then please rate my post
ok try this...
Thanks alot eimroda
Your sample really works. Now i can complete my system and do my presentation. Wish me luck ok.
Thanks again and Have a nice day
ur welcome! Good Luck buddy! ;)
(now u can mark this thread RESOLVED :)
Hai you guys!!! Thank you so much. My presentation yesterday was a success. Thanks to all of you who had help me so much in completing my project. VBForums is the BEST!!!!!