473,324 Members | 2,257 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,324 software developers and data experts.

error in printing the date

198 100+
hello
i want to access the data from sql server which lies in particular date . I select the date from my vb form DTPicker and my query is

Str3 = "SELECT * FROM New_Rec where From_Date = # " & Format(DTPFrom & " 00:00:00", "dd/mm/yyyy hh:mm:ss AMPM") & " # AND To_Date = # " & Format(DTPTo & " 23:59:59", "dd/mm/yyyy hh:mm:ss AMPM") & "#"

where from_date and To_date are date column and DTPFrom , DTPTo are DTPicker .
In DTPFrom, the format of value is 01\dec\2007 07:00 AM
in DTPTo , the format of value is 04\apr\2007 02:30 PM
can i change the format of DTPicker or chechk the query and give perfect code
Mar 10 '08 #1
3 1500
debasisdas
8,127 Expert 4TB
Try setting and using the custom format and parse the value before processing in database.
Mar 10 '08 #2
veer
198 100+
Hi
this is my query it does not produce any error but can't insert any value into new_rec table

Str3 = "insert into new_rec SELECT * FROM new where From_Date = '" & Format(DTPFrom & " 00:00:00", "dd/MMM/yyyy hh:mm:ss AMPM") & "' AND To_Date = '" & Format(DTPTo & " 23:59:59", "dd/MMM/yyyy hh:mm:ss AMPM") & "'"
rs1.Open Str3, con, adOpenDynamic, adLockBatchOptimistic, adCmdText







Try setting and using the custom format and parse the value before processing in database.
Mar 11 '08 #3
pureenhanoi
175 100+
Hi
this is my query it does not produce any error but can't insert any value into new_rec table

Str3 = "insert into new_rec SELECT * FROM new where From_Date = '" & Format(DTPFrom & " 00:00:00", "dd/MMM/yyyy hh:mm:ss AMPM") & "' AND To_Date = '" & Format(DTPTo & " 23:59:59", "dd/MMM/yyyy hh:mm:ss AMPM") & "'"
rs1.Open Str3, con, adOpenDynamic, adLockBatchOptimistic, adCmdText
Try:
Con.Excute Str3
Mar 13 '08 #4

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

Similar topics

16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
1
by: Earl Anderson | last post by:
Using WinXP & AccessXP, I'd like to automatically have the records that I've just printed in a report automatically updated to have the 'print date & time' immediately inserted into a 'Date/Time'...
5
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
7
by: news | last post by:
Recently our mail from our e-commerce site has been rejected by AOL due to an IP block because someone was using our PHP scripts to send spam. Well, I got that fixed. But our legitimate...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
5
by: kyosohma | last post by:
Hi, I am populating a mySQL database with data from the MS Access database. I have successfully figured out how to extract the data from Access, and I can insert the data successfully into mySQL...
1
by: belinda | last post by:
I have used the ff command but only get the date printout and have no clue whats wrong: 'Printing function ' - opening a Word template with bookmarks ' - read bookmarks list from template and...
1
by: Alexander Higgins | last post by:
>>Thanks for the response.... Point Taken but this is not the case. Thus, if a person writes a text file on her or his computer and does not use UNICODE to save it, the current code page is...
0
by: GiftX | last post by:
VB 6.0 And Spreadsheet - Printing problem Good morning West. After much research, I found this code. It scans the spreadsheet and returns up to the last used cell. ...
8
by: a2rodger | last post by:
I am relatively new to php and am struggling with printing out each result from the following array. Array ( => Array ( => Britney Spears => 7 => http://technorati.com/search/Britney+Spears...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.