here is an example of the code I am using. The 'Bad Record
Length' error occurs here (on the Get... line) and elsewhere in my
program, for this and some other user-defined data types. The
OpenFile function just opens the record file for random access as
read-only and returns the file number. The line that includes the
OpenFile function is equivalent to
intFileUsr = FreeFile
Open <recordfile> For Random Access Read As intFileUsr Len = Len
(usrThis)
As I mentioned previously I can force a restructuring of the data
type by removing reference to an element, attempting to run some code
that includes this element, then reinstating the element. Everything
is fine again then.
Public Type UsrType
LoginID As String * 5
Name As String * 20
SiteID As Byte
DeptID As Integer
Active As Boolean
Password As String * 10
PasswordSetDate As Long
HalfDayHolEnt As Byte
Perm(1 To 20) As Boolean
End Type
Public Sub USR_List(cntThis As MSForms.Control, Optional
blnIncInactive As Boolean)
'Display a list of users in a list or combobox
Dim intFileUsr As Integer
Dim usrThis As UsrType
cntThis.Clear
intFileUsr = OpenFile(FileName(PATH_STATIC, FILETITLE_USR,
FILEEXT_USR), Len(usrThis), False, False)
Do
Get intFileUsr, , usrThis
If EOF(intFileUsr) Then Exit Do
If usrThis.Active Or blnIncInactive Then cntThis.AddItem
usrThis.LoginID
Loop
Close intFileUsr
End Sub