View Single Post
  #3  
Old June 4th, 2010, 08:21 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default this code doesn't work fully

There is no App object in Access.

Private Sub CreateAcc_Click()
Dim intFile As Integer
Dim username As String

username = Me!Text23 & vbNullString
If Len(username) = 0 Then
MsgBox "Enter a Username !"
Else
If Len(Me!Text25 & vbNullString) = 0 Then
MsgBox "Enter a Password !"
Else
intFile = FreeFile()
Open CurrentProject.Path & "\Accounts\Users\" & username & ".txt" For
Output As #intFile
Print #intFile, Me!Text23
Print #intFile, Me!Text25
Close #intFile
End If
End If

End Sub


--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)

"Bob H" wrote in message
...
I am trying to create a login box for an Access 2007 database using some
VB8 code I found:

Private Sub CreateAcc_Click()
Dim username As String
username = Text23
If Text23 = "" Then
MsgBox "Enter a Username !"
Else
If Text25 = "" Then
MsgBox "Enter a Password !"
Else
Open app.Path & "\Accounts\Users\" + username + ".txt" For Output As
#1
Print #1, Text23
Print #1, Text25
Close #1
End If
End If

End Sub

It runs up to the line 'Open app.path etc, then get a runtime error 424,
Object required.
What would that be, and what should the correct syntax be for Open
app.path

Thanks