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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a dump of all variable values

Status
Not open for further replies.

mixedbag

Technical User
Jan 18, 2001
5
0
0
GB
Does anybody know of a way to dump a list of variables and their present values.
I know that you can examine variables when developing, but I want to be ale to log them to a file, when an error ocours once the program is in real use.

Thanks
 
There isn't really an easy way to do it. Unless, of corse, your variables are in arrays... Then it's a cinch.

Without Arrays:
Open App.Path & "ErrLog.txt" for output as 1
Print #1, "Variable1 Value:"
Print #1, Variable1
Print #1, "Variable2 Value:"
Print #1, Variable2
Print #1, "Variable3 Value:"
Print #1, Variable3
And so on...
Close 1

With Arrays:
Open App.path & "ErrLog.txt" for output as 1

For i = 1 to NumberOfValuesInTheArray
Print #1, "Array(" & i & ") Value:"
Print #1, Array(i)
next i
Close 1

You may need to edit the pathname somehow so that it doesn't overwrite itself, and you may need to change the file number if you're already using "1".

That's about all I can give you, hope that helps. I'm not really an expert, I just know the simple stuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top