hey guys,
i'm new user for access 2010, what i need is to copy some data to a text file from a form?
for example:
i have a form have 3 fields, id, user & password;
what i need is to generate a text file for the user field?
any help please
hey guys,
i'm new user for access 2010, what i need is to copy some data to a text file from a form?
for example:
i have a form have 3 fields, id, user & password;
what i need is to generate a text file for the user field?
any help please
any one can help please?
Here is a bit of code I use to create a list of all forms in my ADP and save them to a text file. It should give you a good starting point:
Code:Dim obj As AccessObject Dim dbs As Object Dim myList As String Dim strdn As String Set dbs = Application.CurrentProject myList = Date & vbCr & vbLf For Each obj In dbs.AllForms strdn = obj.Name myList = myList & strdn & vbCr & vbLf Next obj 'Write and save file Open "c:\Program Files\STEP\forms.txt" For Output As #2 Print #2, myList Close #2 'Open file to view ShellExecute 0, vbNullString, "c:\Program Files\STEP\forms.txt", vbNullString, vbNullString, vbNormalFocus
thanks,
but where shall i put this code?
You'll need to adapt it, not copy and paste.
You need to create a string that contains the values entered in your three text boxes, then save that string to the text file using what I've shown you above. As far as where to put it, I'd suggest adding a button to your form and putting it in the OnClick event of the button.
Here ya go, this has most everything you could ever want to know about using VBA to do file handling, including creating files, opening files and even appending to existing files: http://www.xtremevbtalk.com/showthread.php?t=123814