473,382 Members | 1,424 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,382 software developers and data experts.

Problems with mm/dd/yy date format...

patjones
931 Expert 512MB
Hi:

I have a table that contains several date fields. I set the data type of those fields to Date/Time, and the format property (in table design view) to "mm/dd/yy".

Likewise, in the form that I use to populate those fields, I have corresponding text boxes with the format set to "mm/dd/yy" and input mask 00/00/00;0;*

When I enter dates in all of the date text boxes and save the record, everything is fine. But if I leave a particular date text box blank (which is valid for the particular purpose I'm making the application for) - I get a data type conversion error upon trying to save the record. The VB code gets stuck on the line that attempts to save the blank date to the table (which I discern by hitting "debug" when the error dialogue pops up).

What's going on here? Thanks so much for any insight!

Pat
Jun 28 '07 #1
5 2633
FishVal
2,653 Expert 2GB
Hi:

I have a table that contains several date fields. I set the data type of those fields to Date/Time, and the format property (in table design view) to "mm/dd/yy".

Likewise, in the form that I use to populate those fields, I have corresponding text boxes with the format set to "mm/dd/yy" and input mask 00/00/00;0;*

When I enter dates in all of the date text boxes and save the record, everything is fine. But if I leave a particular date text box blank (which is valid for the particular purpose I'm making the application for) - I get a data type conversion error upon trying to save the record. The VB code gets stuck on the line that attempts to save the blank date to the table (which I discern by hitting "debug" when the error dialogue pops up).

What's going on here? Thanks so much for any insight!

Pat
Insight #1.

Would you be so kind to post the code causing fault.
Jun 30 '07 #2
Something the darkest valuts of my mind tells me that I had this issue sometime agao. I had it when tabbing through the fields. When leaving a blank the jet still saw a code in the empty textbox.

I have since used a standard impossible date to be remove the Null situation and also to remove any issues like the one described. The date used as default is 31/12/9999. This allows for <> etc

may be wise to look at how you are focusing and exiting the field !

Gareth
Jun 30 '07 #3
Do you really need the input mask on a date entry? For dates I set the Table field Format to Short Date and the Form field Format to dd/mm/yy no quote marks. I have had no problems with people entering the wrong data as Date fields are so common, they can even enter just 2/7 and the field will populate with 02/07/07.

I hope this helps but I have not been using Access to its fullest for long, and apologise in advance if I have misunderstood your question.
Jul 1 '07 #4
patjones
931 Expert 512MB
Hi:

Thank you for your responses. Here's an example of code...

!fldDateOfNoPayBegin = Me!txtAddDateOfNoPayBegin

fldDateOfNoPayBegin is the field in the table that is assigned Date/Time type and formatted as mm/dd/yy.

txtAddDateOfNoPayBegin is the text box on the form that is formatted as mm/dd/yy.

So, if I leave the text box empty, I get the data type conversion error. I tried using the Nz function in various ways to solve the issue:

!fldDateOfNoPayBegin = Nz(Me!txtAddDateOfNoPayBegin, Null)

...but this does not help matters. What else can I try out?

Thank you!

Pat
Jul 2 '07 #5
patjones
931 Expert 512MB
Hi,

I found a solution by using the "IIf" statement...for example:

!fldDateOfBalUsageBegin = IIf(Me!txtAddDateOfBalUsageBegin = "", Null, Me!txtAddDateOfBalUsageBegin)

This seems to be because the IIf statement is more type-friendly than the Nz statement, which didn't work at all.

Anyway, just wanted to point this out so that people with the same or similar problems could get some insight. Thanks!

Pat
Jul 6 '07 #6

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

Similar topics

1
by: paul | last post by:
Hi everyone, I'm having problems displaying a date in the correct format and I was wondering if anyone knew how to help. I'm using pear to extract a date from our back end database (the date is...
10
by: Fawke101 | last post by:
Hi there, I have a date field in SQL server - that holds dates as DD/MM/YYYY format (GB). Now, i have an ASP application that Adds/Edits records in this table; and i am having real problems...
9
by: Neil | last post by:
I have been coding with ASP for some time now. I am using an ACCESS database. I am in the UK and wish to use DD/MM/YYYY format for dates. I have had no end of problems and possible solutions to...
1
by: Igor Kramarsich - EDIT | last post by:
I'm having problems dealing with dates in my queries/SQL code. I need a search digit date. In form define date field without format I receive results. But I go to define date filed with short date...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
1
by: zerbie45 | last post by:
I have a high number of computers that at logon write some information to a sql 2005 database. Information such as computer name, user name, logon date and logon time are entered. Because...
3
by: rn5a | last post by:
In my local computer, date has been set in this format - dd/MM/yyyy. When I insert records in a MS-Access DB table using ASP.NET, then the records get inserted in the Access DB table exactly in the...
2
by: thewilldog | last post by:
Hello, I've reviewed the archives here to address the issue, but I'm still running into problems. I've got a table field populated with the record date in text "YYYYMMDD" To convert it into a...
4
by: atyndall | last post by:
OK, this is the relevant portion script: <?php $username = '__'; // MySQL Database Username. $password = '__'; // MySQL Database Password. $server = '__'; // MySQL Database server (most...
9
by: TC | last post by:
Hi. I have some ASP written in VB.net which is currently installed on a customers server. The asp connects to a local MySql database and retrieves data for the customers customers. If you see...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.