Re: .BeginTrans

From: Wayne Morgan (comprev_gothroughthenewsgroup_at_hotmail.com)
Date: 01/19/05


Date: Wed, 19 Jan 2005 04:59:52 -0600

In you Dim statement you have

   Dim cnn As Connection

You are not specifying ADO or DAO. There is a DAO connection object also. I
suspect that if you go to Tools|References in the code editor you will find
that you have DAO and ADO both checked and that DAO is higher in the list
than ADO. If you don't specify which one to use, Access will use the first
match if finds in the order that the references are listed. The best option
is to specify as you did with the Recordset Dim statement.

-- 
Wayne Morgan
MS Access MVP
"Chris" <a@b.com> wrote in message 
news:uZoJBlY$EHA.2104@TK2MSFTNGP14.phx.gbl...
> Hi All.  I'm trying to use the ADO connection event .BeginTrans.  However 
> my
> program always gives me the DAO members list when I type the "."
> I have copied the code from an access book that I am working on and it 
> works
> fine in the example.
>
> Any Ideas
>
> Problem is last line of code
>
> Dim strMessage As String
>    Dim rstIssues As New ADODB.Recordset
>    Dim cnn As Connection
>    Dim VarPosition As Variant
>
>    ' Make sure NewAssignee has a value selected.
>    If IsNull(NewAssignee) Then
>        DisplayMessage "You must select an employee to assign issues to."
>        Exit Sub
>    End If
>
>    ' Make sure one or more issues are selected.
>    If IssueList.ItemsSelected.Count = 0 Then
>        DisplayMessage "You must select issues to reassign."
>        Exit Sub
>    End If
>
>    ' Confirm the reassignment.
>    strMessage = "Reassign selected issues to " & NewAssignee.Column(1) &
> "?"
>    If Confirm(strMessage) Then
>
>        ' Display the hourglass icon while reassigning issues.
>        DoCmd.Hourglass True
>        'Open a recordset object in the current database
>        Set cnn = CurrentProject.Connection
>        rstIssues.Open "tblStatofAffairs", cnn, adOpenKeyset,
> adLockOptimistic, _
>            adCmdTableDirect
>        'Begin a transaction before changing the data.
> ->     cnn.BeginTrans  <-- error
>
>
>
>
>
>
>
>
>
>
> Option Compare Database
>
> Option Explicit
>
>
>
> Public Const conAppName = "Issue Tracking"
>
>
>
> Public Sub DisplayMessage(strMessage As String)
>
> ' Display an important message to the user.
>
>       MsgBox strMessage, vbExclamation, conAppName
>
> End Sub
>
>
>
> Public Function Confirm(strMessage As String) As Boolean
>
> ' Ask the user to confirm an action, returning True or False.
>
>      Dim bytChoice As Byte
>
>            bytChoice = MsgBox(strMessage, vbQuestion + vbOKCancel,
> conAppName)
>
>            If bytChoice = vbOK Then
>
>            Confirm = True
>
>       Else
>
>             Confirm = False
>
>      End If
>
>
>
> End Function
>
> 


Relevant Pages

  • Re: button that prompts for a value and then enters it into a field
    ... Dim rs As Object ... Access uses either DAO or ADO to communicate with the underlying Jet ... The FindFirst method is only available in DAO recordsets, ...
    (microsoft.public.access.forms)
  • Re: Warum funktioniert Me.RecordsetClone nicht? (VBA)
    ... Dim rsd as Dao.Recordset ... pro DAO: erheblich schneller als ADO auf Jet-Datenbanken, ... Recordsets mit dem SHAPE-Provider ...
    (microsoft.public.de.access)
  • Re: OpenRecordSet problem
    ... I'm assuming you've got references set to both ADO and DAO (by default, ... Access 2000 and 2002 only have a reference set to ADO. ... Dim rstTemp As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Where is getstring?
    ... You may have ADO referenced, but your code is using DAO: ... Dim rs As ADODB.Recordset ... you wanted to be sure you got a DAO recordset, you should use Dim rs As ...
    (microsoft.public.access.modulesdaovba)
  • Re: Trying to loop through Field Names
    ... Both DAO and ADO have an object called Field. ... changing the Dim statement to "Dim fld As DAO.Field". ...
    (microsoft.public.access.modulesdaovba)