473,789 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve records two dates (MS ACCESS)

2 New Member
I design a report that will show all the records for a particular client and all the records do show in the report BUT when I try to search between dates than only half of the records are showing ....... records in the middle of the date range are missing and EndDate records also doesn't show. I use the following code on the OnClick Event of the OK button on my form
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command4_Click()
  2. On Error GoTo Err_Command4_Click
  3. Dim stCriteria As String
  4. Dim stDocName As String
  5. stLinkCriteria = "([ClientNr]=" & Me.ClientNr & ") AND ([Date] Between #" & Me.BeginDate & "# AND #" & Me.EndDate & "#)"
  6. stDocName = "PersAmendmentMovByDate"
  7. DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
  8. Exit_Command4_Click:
  9. Exit Sub
  10. Err_Command4_Click:
  11. MsgBox Err.Description
  12. Resume Exit_Command4_Click
  13. End Sub
Apr 3 '09 #1
2 1547
NeoPa
32,579 Recognized Expert Moderator MVP
Almost certainly because the dates aren't treated consistently as dates.

A string with a formatted date in it will sort as a string, and not a date.

Does that help?

Welcome to Bytes!
Apr 3 '09 #2
NeoPa
32,579 Recognized Expert Moderator MVP
PS. "#" characters are needed for dates it's true, but it not quite as simple as that. See Literal DateTimes and Their Delimiters (#) for the full lowdown. Particularly about formatting the date into SQL standard format to use in SQL.
Apr 3 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
19654
by: Bayou BoB | last post by:
Hello; Simple question for most I'm sure. I'm curious how many records MS Access will store in a single database? What happens when you reach that number of records? Do you just lose the ability to enter new data? Or will it crash on you? What does one typically do when you are approaching the end of Access' ability to store data? Additionally, how many records will SQL store? Thanks! Kevin
2
1579
by: Manal | last post by:
What is the max number of records in Access?
13
3438
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end of the form which is submit and cancel. After i have clicked submit, the information is stored directly into my corresponding database table. My problem here is i need to retrieve back the information submitted to display all the data that the...
0
1641
by: padhuwork | last post by:
Hi, I want to create a Windows DLL using VC++ 6.0 which connects to SQL Server. After establishing the connection, I want to retrieve records from table (query) and out put the recordset to a text file. Can you any expert, give me ideas as to how to go about? I have used the following code for connection and connection is successful. I m able to insert records (i got the code from codeproject website). I was successfully able to insert...
1
3035
by: hims | last post by:
hi i want to retrieve data from access through vb6.0 program but its not working. either sort out my error or help me with correct coding. thanks in advance !!!!!!! mail me at himanshu_s27@rediffmail.com my coding: Private Sub Command5_Click() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset
1
3942
by: gudipati | last post by:
hi,i have one problem.actually we can retrieve data from access. what is my requirement is when i retrieve data from access i want to store in text areas. finely,we can store if they r textboxes using "value" attribute.see for sample <input type="text" name="lastName" maxlength="50" size="20" value="<% If (Request("visitationID") <> "") Then response.Write(rstvalues("lastName")) End If %> "></td> but in TextArea we have no option...
2
1147
vikas1111
by: vikas1111 | last post by:
Hi All.. I want to access records from access database and edit them and save the changes using visual basic.. How can i do that ??? Can anyone please help me???
4
7560
by: Evanescent | last post by:
Hi Guys, I am trying to create a form which allows the users to retrieve records based on the values entered or chosen in the various combo boxes and textboxes, such as the customer's name, invoice number, service number and installation site. The users do not have to enter all the information for the search. Currently, for the Customer's Name Combo Box, the values are retrieved from the Information Table and when a user selects a name, the...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.