Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using dbs.OpenRecordSet to access a restricted table

Status
Not open for further replies.

aexley

Technical User
Jul 9, 2001
147
GB
Good Afternoon All.

I have a Front End - Back End database and all access to the back end is supposed to be through queries on the FE. Unfortunatly, whilst solving a problem a couple of weeks ago I inadvertantly created a module that directly refers to link to my BE table. The result of this is that nobody else is able to enter any new information because they keep getting a 'no permission' error.

My question is this:

Considering the code below, can I replace the references to the table with references to the query that accesses the table? If so, how? I really don't want to have to grant any direct permissions to the table if I can avoid it.

Code is as follows:

Dim dbs As Database
Dim tbl As Recordset
Dim ConInfFrm As Form

Set dbs = CurrentDb
Set tbl = dbs.OpenRecordset("My Table")
Set ConInfFrm = Forms![My Form]

tbl.AddNew

If DMax("My ID Field", "My Query") = 0 Then
tbl![My ID Field] = 1
Else
tbl![My ID Field] = DMax("[My ID Field]", "[My Query]") + 1
End If

tbl![Field2] = Forms!Myform2![Field2]
' Address
tbl!Field3 = Forms!Myform2!Field3

etc, etc for the remaining fields in 'My Table'

As ever, thanks in advance for your help.

aexley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top