Page 1 of 4.
Results 1...20 of 67
Code: On Error Resume Next Err.Clear Dim wrkODBC As Workspace Dim conPubs As Connection Set wrkODBC = CreateWorkspace("", "admin", "", dbUseODBC) Set conPubs = wrkODBC.OpenConnection("", dbDriverNoPrompt, False, getODBCConnectionString) If Err.number 0 Then ' handle error accordingly End IfI can't quite work out the equivalent code using an ADODB.Connection
Code: Dim wrkODBC As Workspace Dim conPubs As Connection Dim rs As Recordset Set wrkODBC = CreateWorkspace("", "admin", "", dbUseODBC) Set conPubs = wrkODBC.OpenConnection("", , False, getODBCConnectionString) Set rs = conPubs.OpenRecordset("SELECT fields FROM mytable", dbOpenSnapshot)Code im already using using ado connections (to execute stored procedures from access) goes something like
Code: Dim objConn As ADODB.Connection Dim objCmd As ADODB.Command Dim sDataConnect As String Dim lngErrorNum As Long ' Instantiate a database connection Set objConn = CreateObject("ADODB.Connection") ' Create an ADO connect string sDataConnect = getOLEConnectionString ' Open a database connection objConn.Open sDataConnect Set objCmd = CreateObject("ADODB.Command") With objCmd .ActiveConnection = objConn .CommandType = adCmdStoredProc .CommandText = "dbo.mystoredproc" etc.etc. .Execute , , adExecuteNoRecords lngErrorNum = .Parameters.item("@err") etc.etc. End With Set objCmd = nothing objConn.close Set objConn = nothingI see lots of examples using currentproject.connection, but I wager this doesnt mean I can share multiple seperate recordsets down the same connection at the same time - should I be creating my own adodb connection each time or only using currentproject.connection. I don't understand how that works - theoretically your access may be connected to several back end db's - what does currentproject.connection actually point to? Im guessing currentproject.connection = linked tables (which is what most of my code based querying accesses)
Code: If Not AllowAdd Then cmdAdd.visible = False Me.AllowAdditions = False End If If Not AllowDelete Then cmdDelete.visible = False Me.AllowDeletions = False End If If Not AllowEdit Then For ctl in controls ctl.locked = True Loop End If ...or
Code: If AllowEdit Then Me.cboMenu.RowSource = Me.Me.cboMenu.RowSource & _ "Modify records;" End If If AllowApprovePurchase Then Me.cboMenu.RowSource = Me.cboMenu.RowSource & _ "Review Purchase Orders;" End If If AllowUserAdmin Then Me.cboMenu.RowSource = Me.cboMenu.RowSource & _ "User Administration;" End If If ShowExpired Then Me.cboMenu.RowSource = Me.cboMenu.RowSource & _ "List of suppliers with expired certificates;" End If ...This is generally on the Form_Load() procedure of each form that restricts user access, although sometimes it's in the middle of the code, such as when retrieving email addresses for users that are supposed to receive requests/status updates. It works, but it gets incredibly messy to maintain such as when adding or modifying a permission. I thought of managing this in its own module, but I'm having trouble figuring out how it could work.
Code: Set con = db.Containers("Tables") Do Until rs.EOF Set doc = con.Documents(rs!Local_Table_Name) For Each grp In wrkDefault.Groups doc.UserName = grp.Name doc.Permissions = dbSecRetrieveData For Each use In grp.Users doc.UserName = use.Name doc.Permissions = dbSecRetrieveData Next Next rs.MoveNext LoopIs there a way to get this same result from Access 2007?
Page 1 of 4.
Results 1...20 of 67