A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

.BeginTrans



 
 
Thread Tools Display Modes
  #1  
Old January 18th, 2005, 07:08 PM
Chris
external usenet poster
 
Posts: n/a
Default .BeginTrans

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


  #2  
Old January 18th, 2005, 09:18 PM
Brendan Reynolds
external usenet poster
 
Posts: n/a
Default

What error? What's the message? Is there a number?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


"Chris" wrote in message
...
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




  #3  
Old January 19th, 2005, 10:30 AM
Chris
external usenet poster
 
Posts: n/a
Default

Compile error:
Method or data member not found (Highlighting the .BeginTrans)

I can't get the options for ADO connections just the ones for DAO
connections.

"Brendan Reynolds" brenreyn at indigo dot ie wrote in message
...
What error? What's the message? Is there a number?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


"Chris" wrote in message
...
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






  #4  
Old January 19th, 2005, 11:59 AM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default

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" wrote in message
...
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




  #5  
Old January 19th, 2005, 12:28 PM
Brendan Reynolds
external usenet poster
 
Posts: n/a
Default

That was my first thought, too, Wayne, but if that is the problem, shouldn't
the code be raising an error earlier, on the "Set cnn =
CurrentProject.Connection" line? Or after that, when attempting to use cnn
in the Open method of the recordset?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


"Wayne Morgan" wrote in message
...
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" wrote in message
...
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






  #6  
Old January 19th, 2005, 03:19 PM
Chris
external usenet poster
 
Posts: n/a
Default

That worked. I swapped the priority around.

Thankyou Wayne and Brendan


"Wayne Morgan" wrote in message
...
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" wrote in message
...
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






  #7  
Old January 20th, 2005, 03:32 PM
Wayne Morgan
external usenet poster
 
Posts: n/a
Default

Chris,

While swapping the priority will work, I would recommend that you actually
specify which library to use in your Dim statement. If you specify, you
won't have to worry about the order, should it every get changed.

--
Wayne Morgan
MS Access MVP


"Chris" wrote in message
...
That worked. I swapped the priority around.

Thankyou Wayne and Brendan



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.