From: anthony on
Why does the last line in this code lead to the error message
"Overflow"? The figure in question is 33764 which is the value of
txtPhotoID before trying to assign it to intPhotoID. If I declare
intPhotoID as String, then all is well

Dim intPhotoID As String
Dim intProjectTeacherID As Integer
Dim strActivity As String
Dim strSequence As String
Dim strProfile As String
Dim DB As Database
Dim RST As Recordset
Set DB = CurrentDb

Set RST = DB.OpenRecordset("tblProjectTeacherPhotoLNK")
intPhotoID = Me.txtPhotoID
From: XPS35 on
anthony wrote:

>
> Why does the last line in this code lead to the error message
> "Overflow"? The figure in question is 33764 which is the value of
> txtPhotoID before trying to assign it to intPhotoID. If I declare
> intPhotoID as String, then all is well
>
> Dim intPhotoID As String
> Dim intProjectTeacherID As Integer
> Dim strActivity As String
> Dim strSequence As String
> Dim strProfile As String
> Dim DB As Database
> Dim RST As Recordset
> Set DB = CurrentDb
>
> Set RST = DB.OpenRecordset("tblProjectTeacherPhotoLNK")
> intPhotoID = Me.txtPhotoID

The range for integers is -32.768 tot 32.767.

--
Groeten,

Peter
http://access.xps350.com

From: mie via AccessMonster.com on
Use 'Long' not integer,

Dim intPhotoID As Long

anthony wrote:
>Why does the last line in this code lead to the error message
>"Overflow"? The figure in question is 33764 which is the value of
>txtPhotoID before trying to assign it to intPhotoID. If I declare
>intPhotoID as String, then all is well
>
>Dim intPhotoID As String
>Dim intProjectTeacherID As Integer
>Dim strActivity As String
>Dim strSequence As String
>Dim strProfile As String
>Dim DB As Database
>Dim RST As Recordset
>Set DB = CurrentDb
>
>Set RST = DB.OpenRecordset("tblProjectTeacherPhotoLNK")
>intPhotoID = Me.txtPhotoID

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201005/1

From: anthony on
On May 25, 8:55 pm, XPS35 <xps...(a)gmail.com> wrote:
> anthony wrote:
>
> > Why does the last line in this code lead to the error message
> > "Overflow"? The figure in question is 33764 which is the value of
> > txtPhotoID  before trying to assign it to intPhotoID. If I declare
> > intPhotoID as String, then all is well
>
> > Dim intPhotoID As String
> > Dim intProjectTeacherID As Integer
> > Dim strActivity As String
> > Dim strSequence As String
> > Dim strProfile As String
> > Dim DB As Database
> > Dim RST As Recordset
> > Set DB = CurrentDb
>
> > Set RST = DB.OpenRecordset("tblProjectTeacherPhotoLNK")
> > intPhotoID = Me.txtPhotoID
>
> The range for integers is -32.768 tot 32.767.
>
> --
> Groeten,
>
> Peterhttp://access.xps350.com

Ah, silly me. Many thanks