Results 1 to 5 of 5
  1. #1
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071

    Recordset Open Error

    I have the following code in an Access 2010 Report



    Code:
        Dim lpctr As Long
        Dim rs As New ADODB.Recordset
        Dim strsql As String, lngcomplete As Long, lngincomplete As Long
        lngcomplete = 0
        lngincomplete = 0
        strsql = "Select Status, mbrs from qry_COA_Total_Patients where pcpid = """ & _
            Me.PCPID & """;"
        rs.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
        Do Until rs.EOF
            Select Case rs!Status
                Case Is = "Complete"
                    lngcomplete = rs!mbrs
                Case Is = "Incomplete"
                    lngincomplete = rs!mbrs
            End Select
        Loop
    I'm getting a "No Value given for one or more required parameters" on the line of code that opens a record set the SQL is very simple If I plug it into a new query it runs perfectly but it won't run in code????

    The Report source is a summation query of a detail query. The detail query lists all patients for 3 specific measures we are tracking. We also need to know how many individual patients are in these 3 measures as a patient could be in 1,2 or all 3. So I have a query to group the individual patients by status and pcp. The qry_COA_Total_Patients query then counts those patients by status. There are no parameters in any of the queries other than the where clause above.

    Any help is appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Does qry_COA_Total_Patients have dynamic parameters?

    Review http://forums.aspfree.com/microsoft-...or-538826.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    No it does not

    Here's the SQL
    Select pcpid,status,count(memberid) from qry_COA_mbrship_step_one group by pcpid,status

    Here's the SQL for qry_COA_mbrship_step_one

    Select pcp,status,memberid from qry_COA_Detail

    and finally here's the SQL for qry_COA_Detail

    Select * from dbo_V_is_HVVMG_MeasureData where measure = "COA"

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Is PCPID a text or number field?

    Why 4 queries where one will work? Why two boolean variables?

    Try:

    strSQL = "SELECT pcpid, status, Count([memberid]) AS CountMemb FROM dbo_V_is_HVVMG_MeasureData WHERE measure='COA' AND PCPID='" & Me.PCPID & "' GROUP BY pcpid, status;"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    PCPID is a text field with mostly numeric data. That's what I inherited not what I would have picked. one query will not work due to the data. The same member could be in 1,2 or all 3 measures so it should still be counted for this purpose as 1 regardless. For example:

    Dr Smith has 7 Patients All 4 need all of the measures 2 need 2 of the measures and 1 needs 1 measure. This results in 17 measures. putting it in 1 query gives me 17 not 7.

    What Boolean variables. There are none. unless that's where I'm messing up. and just don't see them.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-03-2013, 11:51 AM
  2. recordset open error on SQL query
    By Siuxia in forum Programming
    Replies: 5
    Last Post: 05-30-2012, 08:02 AM
  3. Excel sheet open in recordset
    By waqas in forum Programming
    Replies: 3
    Last Post: 09-22-2011, 11:47 AM
  4. open recordset with variable SQL
    By rivereridanus in forum Queries
    Replies: 4
    Last Post: 07-27-2011, 12:58 PM
  5. ADO Recordset.Open (SQL) does nothing
    By workindan in forum Programming
    Replies: 3
    Last Post: 06-23-2010, 02:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums