Eror 3219 Invalid operation

G

Guest

I have managed to get a password function working using the code on this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the active
..mdb file.

However, if I put the tblPassword table in another mdb and link it I get an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
D

Douglas J. Steele

You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")
 
G

Guest

I tried and now I get an error 3251 Operation is not supported for this type
of object

Any further suggestions

Ray

Douglas J. Steele said:
You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ray said:
I have managed to get a password function working using the code on this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link it I get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
D

Douglas J. Steele

Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web" for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried and now I get an error 3251 Operation is not supported for this
type
of object

Any further suggestions

Ray

Douglas J. Steele said:
You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ray said:
I have managed to get a password function working using the code on this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
G

Guest

I tried the workaround by putting the following code in my module

Public Function OpenForSeek(tblPassword As String) As Recordset

Set OpenForSeek =
DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(tblPassword).Connect, 11), False, False, "").OpenRecordset(tblPassword, dbOpenTable)
End Function

I put the following in the call

Dim rst As Recordset
Set rst = OpenForSeek("tblPassword")

I have changed the rs.seek and rs.index and rs.close to rst.*

And when the form opens I get a "Select Data Source" input box.

The only reason I need to do this is so I can access the linked table to
reset the password if the user loses it. If there is a better way I am open
to that as an alternative.

Ray


Douglas J. Steele said:
Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web" for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried and now I get an error 3251 Operation is not supported for this
type
of object

Any further suggestions

Ray

Douglas J. Steele said:
You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have managed to get a password function working using the code on this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
D

Douglas J. Steele

Realistically, any home-grown security method isn't secure anyhow, so I see
no point in bothering. Yes, I realize Microsoft posted the suggestion, but
that still doesn't mean it's worthwhile.

If you're really determined to do it, you can simply use a query with a
Where clause, and see whether it returns any records:

Set rs = db.OpenRecordset("SELECT * FROM tblPassword WHERE ObjectName ='" &
Me.Name & "'")
If rs.EOF Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
End If
rs.Close

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried the workaround by putting the following code in my module

Public Function OpenForSeek(tblPassword As String) As Recordset

Set OpenForSeek =
DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(tblPassword).Connect,
11), False, False, "").OpenRecordset(tblPassword, dbOpenTable)
End Function

I put the following in the call

Dim rst As Recordset
Set rst = OpenForSeek("tblPassword")

I have changed the rs.seek and rs.index and rs.close to rst.*

And when the form opens I get a "Select Data Source" input box.

The only reason I need to do this is so I can access the linked table to
reset the password if the user loses it. If there is a better way I am
open
to that as an alternative.

Ray


Douglas J. Steele said:
Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web" for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried and now I get an error 3251 Operation is not supported for this
type
of object

Any further suggestions

Ray

:

You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have managed to get a password function working using the code on
this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
G

Guest

Thanks a lot Douglas,

That worked great. I do need to do it because the app is on a nonsecure
computer with many peopl access and "some" who might want to mess around with
the data.

Thanks again for your help.

Ray

Douglas J. Steele said:
Realistically, any home-grown security method isn't secure anyhow, so I see
no point in bothering. Yes, I realize Microsoft posted the suggestion, but
that still doesn't mean it's worthwhile.

If you're really determined to do it, you can simply use a query with a
Where clause, and see whether it returns any records:

Set rs = db.OpenRecordset("SELECT * FROM tblPassword WHERE ObjectName ='" &
Me.Name & "'")
If rs.EOF Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
End If
rs.Close

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried the workaround by putting the following code in my module

Public Function OpenForSeek(tblPassword As String) As Recordset

Set OpenForSeek =
DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(tblPassword).Connect,
11), False, False, "").OpenRecordset(tblPassword, dbOpenTable)
End Function

I put the following in the call

Dim rst As Recordset
Set rst = OpenForSeek("tblPassword")

I have changed the rs.seek and rs.index and rs.close to rst.*

And when the form opens I get a "Select Data Source" input box.

The only reason I need to do this is so I can access the linked table to
reset the password if the user loses it. If there is a better way I am
open
to that as an alternative.

Ray


Douglas J. Steele said:
Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web" for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I tried and now I get an error 3251 Operation is not supported for this
type
of object

Any further suggestions

Ray

:

You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have managed to get a password function working using the code on
this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
D

Douglas J. Steele

Anyone who wants to mess around with the data will certainly be able to.
What you've done is the equivalent of locking your car doors, but leaving
the windows open.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
Thanks a lot Douglas,

That worked great. I do need to do it because the app is on a nonsecure
computer with many peopl access and "some" who might want to mess around
with
the data.

Thanks again for your help.

Ray

Douglas J. Steele said:
Realistically, any home-grown security method isn't secure anyhow, so I
see
no point in bothering. Yes, I realize Microsoft posted the suggestion,
but
that still doesn't mean it's worthwhile.

If you're really determined to do it, you can simply use a query with a
Where clause, and see whether it returns any records:

Set rs = db.OpenRecordset("SELECT * FROM tblPassword WHERE ObjectName ='"
&
Me.Name & "'")
If rs.EOF Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
End If
rs.Close

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
I tried the workaround by putting the following code in my module

Public Function OpenForSeek(tblPassword As String) As Recordset

Set OpenForSeek =
DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(tblPassword).Connect,
11), False, False, "").OpenRecordset(tblPassword, dbOpenTable)
End Function

I put the following in the call

Dim rst As Recordset
Set rst = OpenForSeek("tblPassword")

I have changed the rs.seek and rs.index and rs.close to rst.*

And when the form opens I get a "Select Data Source" input box.

The only reason I need to do this is so I can access the linked table
to
reset the password if the user loses it. If there is a better way I am
open
to that as an alternative.

Ray


:

Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web"
for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I tried and now I get an error 3251 Operation is not supported for
this
type
of object

Any further suggestions

Ray

:

You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have managed to get a password function working using the code
on
this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within
the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link
it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 
G

Guest

Yes I know except that these people barely know how to turn the computer on,
let alone open a kinked database. But if it is on, and they USED to be
responsible for this job, they can be vindictive. A volunteer organization.



Douglas J. Steele said:
Anyone who wants to mess around with the data will certainly be able to.
What you've done is the equivalent of locking your car doors, but leaving
the windows open.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ray said:
Thanks a lot Douglas,

That worked great. I do need to do it because the app is on a nonsecure
computer with many peopl access and "some" who might want to mess around
with
the data.

Thanks again for your help.

Ray

Douglas J. Steele said:
Realistically, any home-grown security method isn't secure anyhow, so I
see
no point in bothering. Yes, I realize Microsoft posted the suggestion,
but
that still doesn't mean it's worthwhile.

If you're really determined to do it, you can simply use a query with a
Where clause, and see whether it returns any records:

Set rs = db.OpenRecordset("SELECT * FROM tblPassword WHERE ObjectName ='"
&
Me.Name & "'")
If rs.EOF Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
End If
rs.Close

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I tried the workaround by putting the following code in my module

Public Function OpenForSeek(tblPassword As String) As Recordset

Set OpenForSeek =
DBEngine.Workspaces(0).OpenDatabase(Mid(CurrentDb().TableDefs(tblPassword).Connect,
11), False, False, "").OpenRecordset(tblPassword, dbOpenTable)
End Function

I put the following in the call

Dim rst As Recordset
Set rst = OpenForSeek("tblPassword")

I have changed the rs.seek and rs.index and rs.close to rst.*

And when the form opens I get a "Select Data Source" input box.

The only reason I need to do this is so I can access the linked table
to
reset the password if the user loses it. If there is a better way I am
open
to that as an alternative.

Ray


:

Shoot, that's right. You can't use Seek on a linked table.

See http://www.mvps.org/access/tables/tbl0006.htm at "The Access Web"
for
the work-around.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I tried and now I get an error 3251 Operation is not supported for
this
type
of object

Any further suggestions

Ray

:

You can't use dbOpenTable with a linked table.

Change

Set rs = db.OpenRecordset("tblPassword", dbOpenTable)

to

Set rs = db.OpenRecordset("tblPassword")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have managed to get a password function working using the code
on
this
Microsoft page.

http://support.microsoft.com/kb/209871

My code works perfectly if I create the table tblPassword within
the
active
.mdb file.

However, if I put the tblPassword table in another mdb and link
it I
get
an
Error 3219 Invalid Operation message.

I am thinking towards the recordset part of the code which is as
follows:

DoCmd.OpenForm "frmPassword", acNormal, , , , acDialog
Hold = MyPassword
' Open the table that contains the password.
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPassword", dbOpenTable)
rs.Index = "PrimaryKey"
rs.Seek "=", Me.Name
If rs.NoMatch Then
MsgBox "Sorry cannot find password information. Try Again"
Cancel = -1
Else
' Test to see if the key generated matches the key in
' the table; if there is not a match, stop the form
' from opening.
If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then
MsgBox "Sorry you entered the wrong password." & _
"Try again.", vbOKOnly, "Incorrect Password"
Cancel = -1
DoCmd.Quit

Any help appreciated.

Thanks.

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top