MS Access to Visual Studio conversion problems

M

M Skabialka

Having several years of MS Access experience, I have decided to learn Visual
Studio as well. I took an Access inventory database, and converted the data
to SQL Express. So far so good.



Then I started creating my new Windows form in VS (Visual Basic) to match
the Access form, using the newly converted table I had used in Access. I
did a drag and drop to copy all of the table fields to the new form, just as
I would have in Access, and tidied them up on the form.



But then things go haywire. Since this is an inventory table, there are
many date fields, order date, purchase date, received date, warranty expires
date, user acquired date, disposal date, etc. Obviously, some of these
dates are null, as the event hasn't occurred, or I don't know it. If I look
directly into the table data from Visual Studio it shows NULL.

However, when I scroll from record to record on the form, any date field
which should be NULL shows today's date, though it doesn't change it to that
date (thank goodness!).

Each date field was created on the form automatically by the drag and drop
as a datetimepicker format, a calendar drop-down box and shows a default
date of today. I would rather show NULL or blank, e.g. one of the dates is
a disposal date, and the item is not disposed of yet.

I have tried to find help in the VS newsgroups but they all point to one
article at codeproject that makes no sense to a new VS programmer such as
myself. Everything seems to imply that null dates are completely
unacceptable in Visual Studio projects on forms which are bound to tables.


Does anyone have any experience taking Access databases with null dates,
converting them to Visual Studio, and solving the nullable date time
problem?


Thanks,
Mich
 
B

Brendan Reynolds

My solution, so far, is to not use the date/time picker control. I use text
boxes with range validators for dates. Admittedly, though, all my .NET work
so far has been in ASP.NET, so I can't say for sure if I would take the same
approach in a Windows Forms app.

Another alternative is to use drop-down lists for year, month, and day, as
many Web pages do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top