473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dates in SQL

10
im using this code to get the records between what i typ in text 48 and text 50

well its not working ... please help

Expand|Select|Wrap|Line Numbers
  1.  Dim stDocName As String
  2.  Dim stLinkCriteria As String
  3.     stDocName = "View_StockD_mm"
  4.  
  5.     stLinkCriteria = "[GIV_price] between" & "#" & Me![Text48] & "#and#" & Me![Text50] & "#"
  6.     DoCmd.OpenForm stDocName, acFormDS, stLinkCriteria
Oct 25 '07 #1
7 1486
NeoPa
32,556 Expert Mod 16PB
You have (accidentally) posted this question in the Access Articles section. This is NOT an article.
I'm moving this to the main Access questions forum.

ADMIN.
Oct 25 '07 #2
nico5038
3,080 Expert 2GB
Assuming yoyr fields have a valid US formatted date in mm/dd/yyyy format, change:
"#and#"
into
"# and #"

Nic;o)
Oct 25 '07 #3
NeoPa
32,556 Expert Mod 16PB
You don't leave spaces where required and you haven't ensured the TextBox entries are dates in the correct SQL date format (m/d/y). Try instead :
Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3.  
  4.   stDocName = "View_StockD_mm"
  5.  
  6.   stLinkCriteria = "[GIV_price] Between #" & Format(Me![Text48],'m/d/yyyy') & _
  7.                    "# And #" & Format(Me![Text48],'m/d/yyyy') & "#"
  8.   DoCmd.OpenForm stDocName, acFormDS, stLinkCriteria
***EDIT***
This is basically the same as what Nico said (which I saw after I refreshed :)
Also, this assumes (from the hashes (#)) that you are actually talking about dates. Your question was really quite unclear.
Oct 25 '07 #4
ADezii
8,834 Expert 8TB
im using this code to get the records between what i typ in text 48 and text 50

well its not working ... please help

Expand|Select|Wrap|Line Numbers
  1.  Dim stDocName As String
  2.  Dim stLinkCriteria As String
  3.     stDocName = "View_StockD_mm"
  4.  
  5.     stLinkCriteria = "[GIV_price] between" & "#" & Me![Text48] & "#and#" & Me![Text50] & "#"
  6.     DoCmd.OpenForm stDocName, acFormDS, stLinkCriteria
[Text48] and [Text50] must be valid Date/Time Data Types for the Criteria to work properly. This is in addition to what FishVal has said.
Oct 25 '07 #5
NeoPa
32,556 Expert Mod 16PB
FishVal????
What did I tell you about those drugs ADezii?!?
Oct 25 '07 #6
ADezii
8,834 Expert 8TB
FishVal????
What did I tell you about those drugs ADezii?!?
Perhaps a wrong Post?
Oct 25 '07 #7
NeoPa
32,556 Expert Mod 16PB
Just yanking your chain my friend ;)
Oct 26 '07 #8

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

Similar topics

8
by: Riley | last post by:
The date fields being saved by a VB program were being saved as #2003-11-22#. For reasons unknown to me these dates began to be saved as "11/22/2003" All of these dates were made dates with the...
7
by: Alistair | last post by:
diary_date = request.form("diary_date") - (from a populated drop down list) strSQL = "SELECT saz_title, saz_text from saz_details where saz_date =#" & diary_date & "#" a response.write...
5
by: PW | last post by:
<rant> Sorry guys, but I just have to whinge. Dates in ASP are a total pain in the butt! I seem to get caught out so many times. I realise its my own fault, but going from the posts in this...
10
by: Colin Steadman | last post by:
I'm a stupid ASP programmer and I dont do Javascript (except for very simple tasks anyway), and I'm in a bit of a predicament. I've used a javascript table sorting script from here: ...
1
by: Don Sealer | last post by:
I have a report that includes 5 different subreports. I'd like to be able to open this report using a date function (Start Date and End Date). I'd like all five subreports to show the data from...
2
by: Rachel Suddeth | last post by:
Is there a way to have the non-selectable dates (those before MinDate and after MaxDate) draw differently so my users can see right away what dates aren't allowed? I'm not seeing it... ...
12
by: Dixie | last post by:
I am trying to calculate the number of workdays between two dates with regards to holidays as well. I have used Arvin Meyer's code on the Access Web, but as I am in Australia and my date format is...
1
by: pitfour.ferguson | last post by:
My dbase has the start date and end date of each visit. How can I ask Access to list the day of the week of the start (easy), end (easy) and, more importantly, the dates of the visit itself - ie...
7
by: evilcowstare via AccessMonster.com | last post by:
Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple. There are some searches that I want to apply to my database....
2
by: Jim Carlock | last post by:
(1) Does PHP provide any way to handle dates prior to 1980? I know there's problems with Microsoft Windows NT and all Windows NT operating systems will allow a date prior to 1980 to be placed...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.