Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Data Type Conversion Error 3421

Geek News

Data Type Conversion Error 3421
JJ 11/12/2008 5:16:10 PM
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
Re: Data Type Conversion Error 3421
"Damon Heron" <damon_327[ at ]hotmail.com> 11/12/2008 5:42:32 PM
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

"JJ" <JJ[ at ]discussions.microsoft.com> wrote in message
news:0D3156CE-9607-48EC-9F96-D64875336FA4[ at ]microsoft.com...
[Quoted Text]
> 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


Re: Data Type Conversion Error 3421
JJ 11/12/2008 8:18:14 PM
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.
"Damon Heron" wrote:

[Quoted Text]
> 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
>
> "JJ" <JJ[ at ]discussions.microsoft.com> wrote in message
> news:0D3156CE-9607-48EC-9F96-D64875336FA4[ at ]microsoft.com...
> > 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
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net