Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converted from 97 to 2000 having problems 1

Status
Not open for further replies.

rjmdt

Programmer
May 17, 2002
38
US
I had to convert a number of databases from access97 to access 2000 and I have a problem with the following code running from a form when a buttton is clicked.

First I get an Error in Alpha1.FormBU Overflow then I get an Alpha1.Append 1/1 Index or primary key cannot contain Null Value.

This code was written by someone else and worked before converting. I can't figure out what the Alpha1.FormBU and Alpha1.Append?

Also are the DoCmd statement going to work in the Access 2000 version.


Thanks


Private Sub Append1_Click()
On Error GoTo errSect
Dim stAction As String
Dim lnerr As Double
Dim dlfctn As Double

stAction = "Alpha1.Append1"
lnerr = 1
dlfctn = False

UofM = UofM
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

exitSect:
Exit Sub

errSect:
MsgBox Err.Description, , "ERROR: " & stAction & "/" & lnerr
Resume exitSect

End Sub
 
Here is the code, with some notes:
Code:
Private Sub Append1_Click()
On Error GoTo errSect
Dim stAction As String
Dim lnerr As Double
Dim dlfctn As Double

'These two lines are used in the error handler
stAction = "Alpha1.Append1"
lnerr = 1

'I can't see the point of this
dlfctn = False

'I can't see the point of this
UofM = UofM
'This has not been used for a while:
'DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'This is the new version:
DoCmd.RunCommand acCmdSaveRecord

exitSect:
Exit Sub

errSect:
MsgBox Err.Description, , "ERROR: " & stAction & "/" & lnerr
Resume exitSect

End Sub

But I do not see much point in saving the record as Access handles that itself, unless something else is to be done. I cannot see any reference to Alpha1.FormBU in the above code and "Alpha1.Append" is only used in a string, so that should not cause problems. The code as shown above compiles and runs in my version of Access 2000. [ponder]
 
My guess is that the error comes from the table design. You may check the data type of the primary key. If the data type is integer. You may get "Overflow" error if the primary key value is over 32,xxx (I forgot the exact number).

In other words, this error may not caused by the conversion from Access97 to Access2000, but rahter from the addition of records in the table.

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top