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

Date

the date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???
Feb 1 '08 #1
16 1608
lotus18
866 512MB
the date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???
Can you post your sql statement here? Did you check the datatypes of your fields?
Did you enclosed the dates in your sql query with #?

Rey Sean
Feb 1 '08 #2
the date Formats in VB6 n in access are different. i have written an insert query for inserting all details including date into the database but it is not working. i think it is because of this format difference. how do i handle it???


Hey,
u can take the Date as String, then perform ur other tasks.
Feb 1 '08 #3
daniel aristidou
491 256MB
Hey,
u can take the Date as String, then perform ur other tasks.
This is unadvisable.....
Feb 1 '08 #4
creative1
274 100+
You should format your data before your query in a format that is acceptable in Access something like this:
Format$(txtdate.Text, "m/dd/yy")
Regards
Feb 2 '08 #5
This is unadvisable.....
Hi daniel aristidou,
Text1.text is String or other type Data in creative1 ?. Reply me. If u create any mad like comment, u must think before abt that.

Thnks,
shuvo2k6
Feb 2 '08 #6
creative1
274 100+
In my reply I assumed you have entered your data in a textbox that you want to convert. I think you better post what you have in your code. It will be far easy to suggest any thing that will help you.
Feb 2 '08 #7
VACEPROGRAMER
168 100+
Why don't you samply type DATE FORMATS in VB help. And you have what you want

*VACE*
Feb 2 '08 #8
please post your insert code...
Feb 2 '08 #9
In VB6:

Private Sub Command1_Click()
Text1.Text = Format(Date, "dd mmmm, yyyy")
End Sub
Feb 3 '08 #10
rs.Open "insert into Invoice_master(Inv_No,Inv_Date,Inv_Type,Cust_Code, Salesman_Code,Due_Date) values(" & Val(txtInvNo.Text) & ",'" & txtDate.Text & "','" & txtInvType.Text & "'," & Val(txtCustCode.Text) & "," & Val(txtSaleCode.Text) & ",'" & txtDue.Text & "')", con, 3, 3


This is the insert statement. tell me where to make changes.
Feb 3 '08 #11
lotus18
866 512MB
rs.Open "INSERT INTO Invoice_master(Inv_No,Inv_Date,Inv_Type,Cust_Code, Salesman_Code,Due_Date) VALUES " & Val(txtInvNo.Text) & ",'" & txtDate.Text & "','" & txtInvType.Text & "'," & Val(txtCustCode.Text) & "," & Val(txtSaleCode.Text) & ",'" & txtDue.Text & "')", con, 3, 3


This is the insert statement. tell me where to make changes.
Hi

Change your codes to
Expand|Select|Wrap|Line Numbers
  1. rs.Open "INSERT INTO Invoice_master(Inv_No,Inv_Date,Inv_Type,Cust_Code,Salesman_Code,Due_Date) VALUES (" & Val(txtInvNo.Text) & ",#" & txtDate.Text & "#,'" & txtInvType.Text & "'," & Val(txtCustCode.Text) & "," & Val(txtSaleCode.Text) & ",#" & txtDue.Text & "#)", con, 3, 3
  2.  
Rey Sean
Feb 3 '08 #12
Hi

Change your codes to
Expand|Select|Wrap|Line Numbers
  1. rs.Open "INSERT INTO Invoice_master(Inv_No,Inv_Date,Inv_Type,Cust_Code,Salesman_Code,Due_Date) VALUES (" & Val(txtInvNo.Text) & ",#" & txtDate.Text & "#,'" & txtInvType.Text & "'," & Val(txtCustCode.Text) & "," & Val(txtSaleCode.Text) & ",#" & txtDue.Text & "#)", con, 3, 3
  2.  
Rey Sean



I tried the above query bt I am getting the following error....

Syntax error in date in query expression '# #' .
Feb 3 '08 #13
lotus18
866 512MB
I tried the above query bt I am getting the following error....

Syntax error in date in query expression '# #' .
Really?, May I see your sample value in txtDate and txtDue. Are your Inv_Date and Due_Date are Date/Time Datatypes?

Rey Sean
Feb 3 '08 #14
Really?, May I see your sample value in txtDate and txtDue. Are your Inv_Date and Due_Date are Date/Time Datatypes?

Rey Sean
They are Short Dates....
sample:-3/2/2008
Feb 3 '08 #15
lotus18
866 512MB
They are Short Dates....
sample:-3/2/2008
Did you check the datatypes of Inv_Date and Due_Date?

if you're using that format, try this
Expand|Select|Wrap|Line Numbers
  1. Format(Inv_Date, "d/m/yyyy")
  2. Format(Due_Date, "d/m/yyyy")
  3.  

Rey Sean
Feb 3 '08 #16
Killer42
8,435 Expert 8TB
Syntax error in date in query expression '# #' .
This seems to imply that one or the other of your textboxes was empty. What I'd suggest as a debugging aid is to set a break point and copy/paste here the actual string which is being passed to the SQL interpreter. We've seen the code, but I believe we need to see the result of the code.

In other words, set a break point on the Rs.Open statement. When it breaks, go to Immediate window and enter...
Expand|Select|Wrap|Line Numbers
  1. Print "INSERT INTO Invoice_master(Inv_No,Inv_Date,Inv_Type,Cust_Code,  Salesman_Code,Due_Date) VALUES (" & Val(txtInvNo.Text) & ",#" & txtDate.Text & "#,'" & txtInvType.Text & "'," & Val(txtCustCode.Text) & "," & Val(txtSaleCode.Text) & ",#" & txtDue.Text & "#)"
Feb 3 '08 #17

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
9
by: Thomas R. Hummel | last post by:
Hello, I am importing data that lists rates for particular coverages for a particular period of time. Unfortunately, the data source isn't very clean. I've come up with some rules that I think...
30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
3
by: captain | last post by:
Below is the sql for data with same date need to extract + or - 5 days data of same date also. How to also get data of + and - days related to same date. SELECT IM.Area, IM.Location,...
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
3
by: JJ | last post by:
Here's the code. $link="http://xbox360cheat.org"; $close_date=$_POST; #last content change check if ($close_date == 0) $close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.