onespeed
07-28-2014, 07:17 AM
I want to understand the problem I am running into here. I have a number of forms that I am slowly losing capability on due to this error. I want full capability with them again and want to learn how to update them. Below is the error thrown up by the one I use the most.
I am getting the following errors when trying to use my old form in W7/Office 2010:
The Expression On Load you entered as the event property setting produced the following error: User-defined type not defined. The code in this project must be updated for use on 64-bit systems. Please review and update declare statements and then mark them with PtrSafe attribute.
The code:
Private Function ListRecordsets(fld As Control, Id As Variant, row As Variant, col As Variant, Code As Variant) As Variant
Dim ReturnVal
Dim db As DAO.Database
Const MAX_ROWS As Integer = 150
Static Tbls1(MAX_ROWS) As String
Static RowCount As Integer
Static TableIndex As Integer
Static QueryIndex As Integer
Dim TName As String
Set db = CurrentDb
Select Case Code
Case LB_INITIALIZE
RowCount = 0
For TableIndex = 0 To db.TableDefs.Count - 1
TName = db.TableDefs(TableIndex).Name
If Mid(TName, 1, 4) <> "MSys" Then
Tbls1(RowCount) = db.TableDefs(TableIndex).Name
RowCount = RowCount + 1
End If
Next TableIndex
For QueryIndex = 0 To db.QueryDefs.Count - 1
TName = db.QueryDefs(QueryIndex).Name
If Mid(TName, 1, 4) <> "MSys" Then
If db.QueryDefs(QueryIndex).Type = dbQSelect Then
Tbls1(RowCount) = db.QueryDefs(QueryIndex).Name
RowCount = RowCount + 1
End If
End If
Next QueryIndex
ReturnVal = RowCount
Case LB_OPEN
ReturnVal = 123457
Case LB_GETROWCOUNT
ReturnVal = RowCount
Case LB_GETCOLUMNCOUNT
ReturnVal = 1
Case LB_GETCOLUMNWIDTH
ReturnVal = 700
Case LB_GETVALUE
ReturnVal = Tbls1(row)
Case LB_END
For RowCount = 0 To MAX_ROWS
Tbls1(RowCount) = ""
Next
End Select
ListRecordsets = ReturnVal
End Function
I am getting the following errors when trying to use my old form in W7/Office 2010:
The Expression On Load you entered as the event property setting produced the following error: User-defined type not defined. The code in this project must be updated for use on 64-bit systems. Please review and update declare statements and then mark them with PtrSafe attribute.
The code:
Private Function ListRecordsets(fld As Control, Id As Variant, row As Variant, col As Variant, Code As Variant) As Variant
Dim ReturnVal
Dim db As DAO.Database
Const MAX_ROWS As Integer = 150
Static Tbls1(MAX_ROWS) As String
Static RowCount As Integer
Static TableIndex As Integer
Static QueryIndex As Integer
Dim TName As String
Set db = CurrentDb
Select Case Code
Case LB_INITIALIZE
RowCount = 0
For TableIndex = 0 To db.TableDefs.Count - 1
TName = db.TableDefs(TableIndex).Name
If Mid(TName, 1, 4) <> "MSys" Then
Tbls1(RowCount) = db.TableDefs(TableIndex).Name
RowCount = RowCount + 1
End If
Next TableIndex
For QueryIndex = 0 To db.QueryDefs.Count - 1
TName = db.QueryDefs(QueryIndex).Name
If Mid(TName, 1, 4) <> "MSys" Then
If db.QueryDefs(QueryIndex).Type = dbQSelect Then
Tbls1(RowCount) = db.QueryDefs(QueryIndex).Name
RowCount = RowCount + 1
End If
End If
Next QueryIndex
ReturnVal = RowCount
Case LB_OPEN
ReturnVal = 123457
Case LB_GETROWCOUNT
ReturnVal = RowCount
Case LB_GETCOLUMNCOUNT
ReturnVal = 1
Case LB_GETCOLUMNWIDTH
ReturnVal = 700
Case LB_GETVALUE
ReturnVal = Tbls1(row)
Case LB_END
For RowCount = 0 To MAX_ROWS
Tbls1(RowCount) = ""
Next
End Select
ListRecordsets = ReturnVal
End Function