Apr 15th, 2006, 02:25 AM
#1
Thread Starter
Member
[RESOLVED] How to search month range from MS Access?
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...
Apr 15th, 2006, 02:33 AM
#2
Fanatic Member
Re: How to search month range from MS Access?
you can let hte user to input two dates (you can use datetime picker) then in your SQL:
.... WHERE DateField Between 'date1' AND 'date2'
of course, date1 and date2 are dates coming from your date time pickers
On Error GoTo Hell
Hell:
Kill Me
Food For Thought:
- Do not judge a book... if you're not a judge!
Apr 15th, 2006, 02:36 AM
#3
Thread Starter
Member
Re: How to search month range from MS Access?
Sorry eimroda but i'm new to all this. Can you please give me an example.
Thanks alot hope you can help me.
Apr 15th, 2006, 02:40 AM
#4
Fanatic Member
Re: How to search month range from MS Access?
are you using the data environment?
On Error GoTo Hell
Hell:
Kill Me
Food For Thought:
- Do not judge a book... if you're not a judge!
Apr 15th, 2006, 02:47 AM
#5
Thread Starter
Member
Re: How to search month range from MS Access?
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.
Apr 15th, 2006, 02:54 AM
#6
Fanatic Member
Re: How to search month range from MS Access?
wait... i'll make a sample project for you...
On Error GoTo Hell
Hell:
Kill Me
Food For Thought:
- Do not judge a book... if you're not a judge!
Apr 15th, 2006, 02:59 AM
#7
Addicted Member
Re: How to search month range from MS Access?
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
Apr 15th, 2006, 03:08 AM
#8
Fanatic Member
Re: How to search month range from MS Access?
Attached Files
On Error GoTo Hell
Hell:
Kill Me
Food For Thought:
- Do not judge a book... if you're not a judge!
Apr 15th, 2006, 05:17 AM
#9
Thread Starter
Member
Re: How to search month range from MS Access?
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
Apr 15th, 2006, 10:16 PM
#10
Fanatic Member
Re: How to search month range from MS Access?
ur welcome! Good Luck buddy!
(now u can mark this thread RESOLVED
On Error GoTo Hell
Hell:
Kill Me
Food For Thought:
- Do not judge a book... if you're not a judge!
Apr 16th, 2006, 07:39 PM
#11
Thread Starter
Member
Thanks to all who have help me!!!!
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!!!!!
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width