Link to home
Start Free TrialLog in
Avatar of shifty12

asked on

Type/With prob

I can't get this to work. The compiler err is shown in Form_Load. I want to write this to a relative file so I can run my hex-editor to take a peek at it.

'--------------------- in .BAS
 Public Type TP
    ln As Long  ' len of this whole thing
    Tstr As String
    Tlng As Long
    Tint As Integer
  End Type

  Global Rec As TP

'---------------------- in .FRM
Private Sub Form_Load()

  With Rec
    .ln = Len(Rec)
    .Tstr = "ABC"
    .Tlng = 1
    .Tint = 2
  End With

  A$ = Rec  ' <=== type mismatch err
  FR = FreeFile
  Open "TYP.DAT" For Random Access Read Write As #FR Len = 50

  Put #FR, 1, A$
  Close FR
End Sub

Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shifty12


I'm gonna try changing the PUT to use Rec instead of A$, might work. One way or another, I have to get this Type out to a relative file.