I get the below error when running the below code
Run-time error '-2147352567 (80020009)':
The value you entered isn't valid for this field.
The error is on line Me.txtintSubID = rst![intSubscriptionID] but when I remove Me.txtintSubID = rst![intSubscriptionID] then it is on Me.txtvarExtensionSettingValueList = rst![varExtensionSettingValueList]
Also sometimes I run the code and there is no error but sometimes it stops on that line. Does anyone know why? and how to fix it?
Code:
Dim iVal As Integer
iVal = Nz(Me.cbointReportID.Value, "")
Dim iVal2 As String
iVal2 = Nz(Me.cbovarReportTitle.Value, "")
Dim rst As dao.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT intSubscriptionID,varExtensionSettingValueList,bitActiveForNoRecords,bitActive,datStartDate,datEndDate,datAdded,datModified FROM dbo_tbl_Custom_Subscription_Subscriptions WHERE intReportID like " & iVal & " AND varReportTitle like '" & iVal2 & "' ")
Me.txtintSubID = rst![intSubscriptionID]
Me.txtvarExtensionSettingValueList = rst![varExtensionSettingValueList]
Me.cbobitActiveForNoRecords = rst![bitActiveForNoRecords]
Me.cbobitActive = rst![bitActive]
Me.txtdatStartDate = rst![datStartDate]
Me.txtdatEndDate = rst![datEndDate]
Me.txtdatAdded = rst![datAdded]
Me.txtdatModified = rst![datModified]
rst.Close
Set rst = Nothing