DateTimePicker not updating in DB unless I change the date

T

Tony K

Does anyone know why my 2 date fields on my form that are bound to date
fields in the Access DB do not save unless I first modify the dates?
Example: When I add a new record, the following line of code executes adding
5 days to the current date.
Me.DateRequiredDateTimePicker.Value = Today.AddDays(5)

If I do not change the dates on the form for the 2 fields ( one is today's
date, one is a date 5 days in the future ) they do not get saved/updated to
the database. If I highlight either the month, day or year and change it
then change it back the fields get saved.

Thanks,

Tony K.
 
C

Cor Ligthert[MVP]

Tony,

In the way you describe it, it is in my idea exactly as it should be.

Cor
 
T

Tony K

Cor Ligthert said:
Tony,

In the way you describe it, it is in my idea exactly as it should be.
Cor

Ok... New record. The DateTimePickers (2) already have dates in them. The
rest of the text boxes on my vb form are blank. I fill in the textboxes.
Click Save. Open the database and the record is there, but the date fields
are blank. Null. Nothing there.

Same scenario but if I change the date fields then change them back to what
they originally were when I clicked new record, they get added with the
other info.

If that is how it should be then I'll find something else. If makes more
sense and it should not be that way, then I'm sorry for not clarifying the
first time.

Thanks,

Tony K.
 
C

Cor Ligthert[MVP]

Tony,

Did you databind the value of your DateTime picker to the Data column you
are using?

You do that with that closed DataBinding box which is in top of your
propertie settings as it is in non alphabetic mode.

Cor
 
T

Tony K

Yes they are bound to Purchase_OrdersBindingSource - OrderDate and
Purchase_OrdersBindingSource - DateRequired.

Tony K.
 

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