Data Type Conversion Error Help Please

graviz

Registered User.
Local time
Today, 05:18
Joined
Aug 4, 2009
Messages
167
I have some fields on a form that get updated into a table. If I don't have a value in one of the date fields and I run this function, I receive the error "Data Type Conversion Error". The table this information is getting dumped into has fields formatted as a date. I used the Nz function to help somewhat but now I'm getting this error and am stuck. Any ideas?

Private Sub CMD_UPDATE_Click()
Dim CDB As Object
Dim CRS As Object
Dim STR_Prop_Name As String
Dim STR_Prop_Status As String
Dim STR_TSS_D As String
Dim STR_DD_R_D As String
Dim STR_DD_C_D As String
Dim STR_BOM_Submit_D As String
Dim STR_Contract_D As String
Dim STR_Inst_S_D As String
Dim STR_Inst_E_D As String
Dim MySQL As String
STR_Prop_Name = Forms!Frm_Update!LBL_Prop_Name.Caption
STR_Prop_Status = Forms!Frm_Update!CBO_Prop_Status.Value
STR_TSS_D = Nz(Forms!Frm_Update!TXT_TSS_COMP_D.Value)
STR_DD_R_D = Nz(Forms!Frm_Update!TXT_DD_R_D.Value)
STR_DD_C_D = Nz(Forms!Frm_Update!TXT_DD_C_D.Value)
STR_BOM_Submit_D = Nz(Forms!Frm_Update!TXT_BOM_Submit_D.Value)
STR_Contract_D = Nz(Forms!Frm_Update!TXT_Contract_D.Value)
STR_Inst_S_D = Nz(Forms!Frm_Update!TXT_Inst_S_D.Value)
STR_Inst_E_D = Nz(Forms!Frm_Update!TXT_Inst_E_D.Value)
Set CDB = CurrentDb
MySQL = "SELECT * FROM Master_Table WHERE Prop_Name='" & [Forms]![Frm_Update]![LBL_Prop_Name].Caption & "'"
Set CRS = CDB.OpenRecordset(MySQL)
CRS.Edit
CRS("Prop_Name").Value = STR_Prop_Name
CRS("Prop_Status").Value = STR_Prop_Status
CRS("TSS_Completion_Date").Value = STR_TSS_D
CRS("DD_Rcv_Prop_Specs").Value = STR_DD_R_D
CRS("DD_Design_Completed").Value = STR_DD_C_D
CRS("BOM_Submitted_To_Sales").Value = STR_BOM_Submit_D
CRS("Contract_Date").Value = STR_Contract_D
CRS("Install_Start_Date").Value = STR_Inst_S_D
CRS("Install_Completion_Date").Value = STR_Inst_E_D
CRS.Update
Set CRS = Nothing
Set CDB = Nothing
End Sub
 

Users who are viewing this thread

Back
Top Bottom