when editing a record it doesnt save

hello,
I have a button in main.frm called edit with this

Private Sub cmdEdit_Click()
On Error Resume Next
Enabled = False
Load frmAccountDetails
frmAccountDetails.Populate (lstAccounts.ListIndex)
frmAccountDetails.Show
End Sub

and this in details.frm
Private Sub cmdOK_Click()
Dim FileNo As Integer
On Error Resume Next

FileNo = FreeFile
Open "Accounts.ini" For Append Shared As #FileNo
Print #FileNo, Text_Email.Text & ";" & Text_Passwd.Text & ";"
Close #FileNo

frmMain.Enabled = True
frmMain.SetFocus
Unload frmAccountDetails
End Sub

Public Sub Populate(ByVal Record As Long)
'On Error Resume Next
    Dim lngFHandle As Long
    Dim strLine As String
    lngFHandle = FreeFile()
    Open "Accounts.ini" For Input As #lngFHandle
    Dim intRecord As Long
    For intRecord = 0 To Record
       Line Input #lngFHandle, strLine
    Next
    'That has gone through the file till we have the correct record
    Text_Email = Split(strLine, ";")(0)
    Text_Passwd = Split(strLine, ";")(1)
End Sub

but is not saving the edited record!!! why is that?

this is the add button in main.frm that is working fine, but every time I add a record it doesnt show
until I reload the app..

Private Sub cmdAdd_Click()
On Error Resume Next
Enabled = False
frmAccountDetails.Show
End Sub
apleloisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LambersonSoftware EngineerCommented:
aplelois,

Try closing the file after you populate it. Also Write #fileno  instead of Print and see if that makes a difference. Also You might need a path to the Accounts.ini file.

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrianGEFF719Commented:
Perhaps consider using the GetPrivateProfile() API. It provides access to INI files.

See the following article on editing INI files:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21596960.html
0
apleloisAuthor Commented:
ok I just added Close #lngFHandle
at the end of the populate, but now its making a new record!
0
Bob LambersonSoftware EngineerCommented:
aplelois,
I guess I was expecting that your call to populate the new record would append a new record and the cmdOK button would be the button to edit any changes to the populated values. At least that's what it appears the code is doing, but of course I have not tested it.

Bob
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.