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

Opening and Saving a Form

Status
Not open for further replies.

bjarvis

Technical User
Jan 15, 2001
38
US
I am having some trouble with opening and save my form. I am able to save it but then when I go to open it the information that was saved is not in the form. Here's my code for opening and saving.

Private Sub mnuSave_Click(Index As Integer)
On Error GoTo ErrHandler
Dim IFile As Long

CommonDialog1.Filter = "Cost of Production (*.cpd)|*.cpd"
CommonDialog1.FilterIndex = 2

CommonDialog1.ShowSave

IFile = FreeFile
Open CommonDialog1.FileName For Output As IFile

tagExit:
Exit Sub
ErrHandler:
Resume tagExit
End Sub


Private Sub mnuOpen_Click()

Dim IFile As Long
On Error GoTo ErrHandler

CommonDialog1.Filter = "Cost of Production (*.cpd)|*.cpd"
CommonDialog1.FilterIndex = 2

CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Random As IFile
Exit Sub

ErrHandler:
Exit Sub
End Sub
 
Is it just me, or are you not actually saving or loading anything from the file? After you've opened the file ("Open CommonDialog1.FileName For Output As IFile" or "Open CommonDialog1.FileName For Random As IFile") the next thing you do is exit the sub.

If you purposefully omitted what you put into and pulled out of the file, you might want to post that - it'll be necessary to find out what's not saving and why.

Hope this helps,
J



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top