Run-time error -2147352567, The value you entered isn't valid for this field

My access 2010 database works fine and sometime I got "Error No. 2147352567, The value you entered isn't valid for this field."  But most of the time I am getting the error.

 

I am getting the error after a combo box that contains region code (data type = integer), trigger an After_Update event.  Then the combo box will call the below procedure to populate another text box that will show the region description.

 

====== start code ==============

Sub RegionTextUpdate()
    Dim dbsRegion As DAO.Database
    Dim qdfRegion As DAO.QueryDef
    Dim rstRegion As DAO.Recordset
   
    Set dbsRegion = CurrentDb
    Set qdfRegion = dbsRegion.QueryDefs("qryMyRegion")
    
    qdfRegion.Parameters("MyRegion") = Form_frmPipeline.cboRegionCode
    Set rstRegion = qdfRegion.OpenRecordset()
    

 'the error starts here
    Form_frmPipeline.txtRegionDescription = rstRegion!RegionDescription1
      
    rstRegion.Close
    qdfRegion.Close
    dbsRegion.Close
   
End Sub

====== end code ==============

 

Question Info


Last updated November 6, 2018 Views 5,662 Applies to:
Answer

Is it possible your query has no results?  Have you validate using .RecordCount or .EOF and .BOF?

 

Also, I typically would code

 

Form_frmPipeline.cboRegionCode

 

like

 

Forms![Form_frmPipeline].Form.cboRegionCode

Or

Me.cboRegionCode (if Form_frmPipeline is the active form)

 

Similarily for Form_frmPipeline.txtRegionDescription

--
Daniel Pineault
Microsoft MVP 2010-2018

1 person was helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.