Results 1 to 3 of 3
  1. #1
    krausr79 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    16

    Dcount of Query in VBA gives Error 3219

    I have a database which runs quality queries on data before uploading it. Normally I run a series of if Dcount>0 statements on different queries where if there are any results in the query, something is wrong and the upload stops. I have one query in a newer database where trying to do dcount on it gives runtime error 3219. At first I thought it was the iif statements or query criteria based on form fields, but even after I removed them as a test the error remained. Here are the simplified queries:

    qryQC2: runnable, but fails on dcount. A run-of the mill left join of table>query>table:
    SELECT tblLoadCA.LCN, qryOmegaCurrent.LSACONXB, tblLoadCA.CA, O2B_LDMHP.CANUMBHP


    FROM (tblLoadCA LEFT JOIN qryOmegaCurrent ON tblLoadCA.LCN = qryOmegaCurrent.LSACONXB) LEFT JOIN O2B_LDMHP ON (qryOmegaCurrent.IPN = O2B_LDMHP.IPN) AND (qryOmegaCurrent.ISN = O2B_LDMHP.ISN);

    qryOmegaCurrent: Can be dcounted without error. The 'middle' query joined in the first query. Just 4 joined tables:
    SELECT O2B_LDMXA.EIACODXA, O2B_LDMXB.LSACONXB, O2B_LDMHG.PLISNOHG, O2B_LDMHA.CAGECDXH, O2B_LDMHA.REFNUMHA, O2B_LDMHG.ISN, O2B_LDMHG.IPN
    FROM ((O2B_LDMXA INNER JOIN O2B_LDMXB ON O2B_LDMXA.IEN = O2B_LDMXB.IEN) INNER JOIN O2B_LDMHG ON O2B_LDMXB.ISN = O2B_LDMHG.ISN) INNER JOIN O2B_LDMHA ON O2B_LDMHG.IPN = O2B_LDMHA.IPN;

    Anything that's O2B_ is an external ODBC database. I've done several things like this and never encountered the error. Why doesn't this work?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,528
    That is an object error. Are you sure it happens at the sql execute? It sounds like something else in code (an object) is not getting assigned.

    If the error IS in the sql,...
    does it have any paramerters invovled?
    have all tables been refreshed ,in case there where table modifications?

  3. #3
    krausr79 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    16
    In the immediate window if I type
    msgbox(Dcount("*","qryOmegaCurrent"))
    then I get a messagebox with the correct number of records.

    if I type
    msgbox(Dcount("*","qryQC2"))
    then I get the error.

    Or I should say I got the error. I made a workaround that uses recordset EOF and BOF and that worked fine. Then we uploaded some data. Then I got your reply and started checking again and with the new test data there is no error.. I can use Dcounts just fine.

    In the previous data set, both queries were simple select queries made in the query designer. Neither had parameters. I am not familiar with refreshing tables unless you are referring to the form.refresh of a form with data on it.

    Since I am now unable to repeat the error and have a workaround, I'm marking this thread as solved, though I don't actually know what caused the problem in the first place.

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

Similar Threads

  1. DCount Error
    By tareyj8569 in forum Access
    Replies: 2
    Last Post: 10-14-2014, 02:27 AM
  2. DCount Error
    By drewetzel in forum Access
    Replies: 5
    Last Post: 02-13-2014, 06:57 AM
  3. Dcount Error
    By waqas in forum Queries
    Replies: 3
    Last Post: 07-28-2012, 08:24 PM
  4. DCount on a Query giving #Name? error
    By Huddle in forum Access
    Replies: 9
    Last Post: 06-20-2012, 11:40 AM
  5. runtime error 3219
    By Rider570 in forum Programming
    Replies: 3
    Last Post: 07-07-2010, 09:12 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