Results 1 to 2 of 2
  1. #1
    klnlsu is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    107

    Finding records in table using DCOUNT but not finding them in SELECT

    Can someone please examine the coding below and see if I have a syntax or logic error. I am using the filter on a form for my parameters in my recordset. The DCount statement finds 10 records, but rs1.EOF = TRUE after the open statement.




    DCWhere = Forms!frmspecialpricingfilter!frmSpecialPricingEnt ryList.Form.Filter

    StrMsg = MsgBox("You are about to add " & DCount("*", "tblSalesSpecialPricing", DCWhere) & " record(s).", vbOKCancel + vbDefaultButton2)
    If StrMsg = vbCancel Then Exit Sub

    ' create new records
    Dim Con1 As New ADODB.Connection, Con2 As New ADODB.Connection

    Set Con1 = CurrentProject.Connection
    Set Con2 = CurrentProject.Connection

    Dim rs1 As New ADODB.Recordset, rs2 As New ADODB.Recordset

    rs1.Open "SELECT * FROM tblSalesSpecialPricing WHERE " & DCWhere, Con1, adOpenDynamic, adLockPessimistic

  2. #2
    klnlsu is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    107
    NEVERMIND. I found the cause. I am using an "*" as a wildcard in my filter, and the ADODB recordset requires an "%".

    Thanks!

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

Similar Threads

  1. Finding Unique Records in a Table
    By Jessica240 in forum Access
    Replies: 3
    Last Post: 03-26-2015, 08:02 AM
  2. Replies: 4
    Last Post: 06-18-2013, 07:36 AM
  3. Replies: 1
    Last Post: 01-30-2013, 03:27 PM
  4. Replies: 5
    Last Post: 07-29-2011, 11:54 AM
  5. Finding Records that are not there!
    By TrudyD1474 in forum Queries
    Replies: 2
    Last Post: 06-18-2010, 04:41 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