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???
16 1608
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
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.
Hey,
u can take the Date as String, then perform ur other tasks.
This is unadvisable.....
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
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
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.
Why don't you samply type DATE FORMATS in VB help. And you have what you want
*VACE*
please post your insert code...
In VB6:
Private Sub Command1_Click()
Text1.Text = Format(Date, "dd mmmm, yyyy")
End Sub
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.
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 -
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
-
Rey Sean
Hi
Change your codes to -
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
-
Rey Sean
I tried the above query bt I am getting the following error....
Syntax error in date in query expression '# #' .
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
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
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 -
Format(Inv_Date, "d/m/yyyy")
-
Format(Due_Date, "d/m/yyyy")
-
Rey Sean
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... - 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 & "#)"
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |