Solved

Open a file and add entry

Posted on 2002-04-24
5
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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