Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

error 3061

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee - 02 Mar 2005 03:17 GMT
Hi group,

i am trying to execute the code below, but i get the following error (3061)
I think that it is erroring on this line:

Set rsPT = dbCurrent.OpenRecordset("qryQtrRptAge")

please help.

thanks
Lee

Code'''
Public Sub AgeGroups()
On Error GoTo Err_AgeGroups
Dim dbCurrent As DAO.Database
Dim rsPT As DAO.Recordset
Dim varreturn As Variant, lngx As Long
Dim LngCount As Long
Dim HoldDate As String

Set dbCurrent = CurrentDb

Set rsPT = dbCurrent.OpenRecordset("qryQtrRptAge")
DoCmd.SetWarnings False

rsPT.MoveLast
rsPT.MoveFirst
LngCount = rsPT.RecordCount
varreturn = SysCmd(acSysCmdInitMeter, "Converting Age Groups", LngCount)
lngx = 0

Do While rsPT.EOF = False
  rsPT.Edit
  With rsPT
     If rsPT![PatientAge] <= 2 Or rsPT![PatientAge] = 0 Then
        rsPT![PatientAgeGroup] = 1
     ElseIf (rsPT![PatientAge] >= 3 And rsPT![PatientAge] <= 6) Then
        rsPT![PatientAgeGroup] = 2
     ElseIf (rsPT![PatientAge] >= 7 And rsPT![PatientAge] <= 12) Then
        rsPT![PatientAgeGroup] = 3
     ElseIf (rsPT![PatientAge] >= 13 And rsPT![PatientAge] <= 18) Then
        rsPT![PatientAgeGroup] = 4
     ElseIf (rsPT![PatientAge] >= 19 And rsPT![PatientAge] <= 25) Then
        rsPT![PatientAgeGroup] = 5
     ElseIf (rsPT![PatientAge] >= 26 And rsPT![PatientAge] <= 35) Then
        rsPT![PatientAgeGroup] = 6
     ElseIf (rsPT![PatientAge] >= 36 And rsPT![PatientAge] <= 45) Then
        rsPT![PatientAgeGroup] = 7
     ElseIf (rsPT![PatientAge] >= 45 And rsPT![PatientAge] <= 55) Then
        rsPT![PatientAgeGroup] = 8
     ElseIf (rsPT![PatientAge] >= 56 And rsPT![PatientAge] <= 65) Then
        rsPT![PatientAgeGroup] = 9
     ElseIf rsPT![PatientAge] > 66 Then
        rsPT![PatientAgeGroup] = 10
     Else
      rsPT![AgeGroup] = 1
    End If
    rsPT.Update
 End With
 lngx = lngx + 1
 rsPT.MoveNext
 Loop
 LngCount = rsPT.RecordCount

Exit_AgeGroups:
   varreturn = SysCmd(acSysCmdClearStatus)
   DoCmd.SetWarnings True
   Exit Sub
Err_AgeGroups:
   If Err.Number = 13 Then
   Resume Next
'    ElseIf Err.Number = 3061 Then
'   Resume Next
   Else
   MsgBox Err & Err.Description
   End If
   
   Resume Exit_AgeGroups
End Sub
Alex Dybenko - 02 Mar 2005 14:50 GMT
Probably something wrong with your query, for example you can not have a
reference to a form in this case, you have to pass value to query parameter

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> Hi group,
>
[quoted text clipped - 77 lines]
>    Resume Exit_AgeGroups
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.