sathyaganapathi
Board Regular
- Joined
- Apr 29, 2021
- Messages
- 81
- Office Version
- 2016
- Platform
- Windows
I am entering data into userform and want to store the data in access database.
I am getting 'Type mismatch' error (run_time error '-2147352571(80020005)' while running the program and the error is pointing out to the below code.
If I enter the date into userform field I am not getting the error and data is saved into access database.
I have not entered any date to the field. It is left blank. There are several date and time fields which will be filled at different time. I cannot enter date into all the fields together.
[/CODE]
I tried with below two codes and did not help.
[/CODE]
[/CODE]
The field "Plab_Update.RouteTime" and "Plab_Update.Release1Date" are set with below format.
[/CODE]
In other VBA code I have used the above code (1st one) and it is working well.
Please help with some solution.
I am getting 'Type mismatch' error (run_time error '-2147352571(80020005)' while running the program and the error is pointing out to the below code.
If I enter the date into userform field I am not getting the error and data is saved into access database.
I have not entered any date to the field. It is left blank. There are several date and time fields which will be filled at different time. I cannot enter date into all the fields together.
VBA Code:
[CODE]rst.Fields("Route_Time").Value = CDate(Plab_Update.RouteTime.Value)
VBA Code:
rst.Fields("H1_Release_DateTime").Value = CDate(Plab_Update.Release1Date.Value)
I tried with below two codes and did not help.
VBA Code:
[CODE]rst.Fields("Route_Time").Value = VBA.Format(Plab_Update.RouteTime.Value, "HH:mm")
VBA Code:
[CODE=vba]rst.Fields("Route_Time").Value = VBA.Format(Plab_Update.RouteTime.Value, "HH:nn")
The field "Plab_Update.RouteTime" and "Plab_Update.Release1Date" are set with below format.
VBA Code:
[CODE]Plab_Update.RouteTime.Value = VBA.Format(Now(), "HH:mm")
VBA Code:
Plab_Update.Release1Date.Value = VBA.Format(Now(), "mm/dd/yyyy HH:mm")
In other VBA code I have used the above code (1st one) and it is working well.
Please help with some solution.