Skip to content
Advertisement

Can’t retrieve data from Access DB query to my VB program

So this is my code so far… I have 2 DateTimePickers in which the user selects the first day of the week and the last day of the week, once selected these two I want to calculate the hours worked on each day and add them so I can display the amount of hours worked of the interval of days selected.

My Work table contains an idEmployee, Date, ArrivalTime, DepartureTime, and a calculated column(Hrs_worked) that displays the amount of hours worked on that day.

When I run the program a message box pops an shows this “Conversion from type ‘DBNull’ to type ‘String’ is not valid” or “Mismatch of data in the expression of criteria” Do I need to change the datetimepickers values to string values?

Im working on Visual Basic Express 2010 with an Access Database

Advertisement

Answer

In SQL you must use a formatted string expression for the date values:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement