Data Type Conversion Error 3421

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

Hi,

I have a funtion that has suddenly developed this error. It has worked fine
and nothing has been changed. stID is where the error happens. So it appears
to be adding the first 2 strings but no the 3rd. I'm at a loss, thank you for
any help.

Function AddFile1(rstTemp As DAO.Recordset, _
long1 As String, photo As String, stID As String)

With rstTemp

.AddNew
!Long = long1
!photonum = photo
!stID = stID

.Update
.Bookmark = .LastModified
End With

End Function
 
Are you using Option Explicit at the beginning of your form module?

a data conversion error means that stID may be an integer or long number (my
guess) that you are showing as string.

try
.stID= stID
Also, why are you using the bang (!) instead of period(.)?

Damon
 
Thanks Damon, I back tracked the variable and found the issue. I tried to use
the "." and it errored out. The problem is solved, thank you for your help.
 
Back
Top