Solved

Open a file and add entry

Posted on 2002-04-24
5
167 Views
Last Modified: 2010-05-02
I need help with a program that will have 2 textboxes that when you put your initals in one and your last 3 digits of your SSN in the second one it opens a file named combined and writes a record in the XXX123 = XXX123 format.  Everytime that this program is ran it will open the same file and write a new record to the file.

0
Comment
Question by:mtbuford
  • 2
  • 2
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6965694
Dim intF As Integer
intF = FreeFile()
Open "MyFile.Txt" For Append As #intF
Print #intF,txtInitials.Text & txtSSN.Text
Close #intF

And that is all there is to it!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6965706
public sub command1_click()
   writeRecord(text1.text & text2.text)
end sub

public sub writeRecord(strID as String)

   Dim ff as Integer
   ff = FreeFile
   
   open strID for output as #ff
   print #ff, "<i don't know exactly what you want to write to the file>"
   close(ff)


end sub
0
 

Author Comment

by:mtbuford
ID: 6965757
When I use your answer TimCottee I get an object required when it gets to the part of writing the record to the file?
0
 

Author Comment

by:mtbuford
ID: 6965880
When I use your answer TimCottee I get an object required when it gets to the part of writing the record to the file?
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6965923
You should replace the txtInitials and txtSSN with the names of the textboxes that this information is recorded in.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question