Private mrstATMDatabase As Recordset
Set grstATMDatabase = datAccounts.Recordset
Dim pstrName As String
pstrName = txtUserName.Text
'Searches the database for the name
grstATMDatabase.FindFirst "Name = " & "'" & _
pstrName & "'"
It works great on the initial form, but on the later forms, I use the same syntax, and i even cut and paste the same data control. On the later forms, I always get the Object variable or With Block variable not set error. At first I thought it was syntax, but it is correct. I can't seem to figure out this problem.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
: Private mrstATMDatabase As Recordset
: Set grstATMDatabase = datAccounts.Recordset
:
: Dim pstrName As String
: pstrName = txtUserName.Text
:
: 'Searches the database for the name
: grstATMDatabase.FindFirst "Name = " & "'" & _
: pstrName & "'"
: It works great on the initial form, but on the later forms, I use the same syntax, and i even cut and paste the same data control. On the later forms, I always get the Object variable or With Block variable not set error. At first I thought it was syntax, but it is correct. I can't seem to figure out this problem.
I may be wrong but you may have to close the database.
grstATMDatabase.close
That may not be the prob but its worth trying i guess
Chris Andersen
: I need to use a database on multiple forms. Well, I put my data control down, and it does what I want it to on the first form. Here is how I did it:
: Private mrstATMDatabase As Recordset
: Set grstATMDatabase = datAccounts.Recordset
:
: Dim pstrName As String
: pstrName = txtUserName.Text
:
: 'Searches the database for the name
: grstATMDatabase.FindFirst "Name = " & "'" & _
: pstrName & "'"
: It works great on the initial form, but on the later forms, I use the same syntax, and i even cut and paste the same data control. On the later forms, I always get the Object variable or With Block variable not set error. At first I thought it was syntax, but it is correct. I can't seem to figure out this problem.