Solved

using external filepath within the DCOUNT

Posted on 2014-02-28
2
661 Views
Last Modified: 2014-02-28
is it possible to use something like an "In" statement within the DCOUNT funciton, if so what is the proper syntax

        i = DCount("RecordLock", "tblInvoice", "ContractNumber =" & Chr(34) & _
                    gContractID & Chr(34) & " and RecordLock = 0")

I want to change the database source from local to an external mdb.
        i = DCount("RecordLock", "tblInvoice IN '\\filepath\mdbname.mdb", "ContractNumber =" & Chr(34) & _
                    gContractID & Chr(34) & " and RecordLock = 0")
0
Comment
Question by:Karen Schaefer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39896297
That won't work in a DCount afaik.

However, you can set up and save a query as qryInvoice:

Select * From tblInvoice IN '\\filepath\mdbname.mdb'

Open in new window


And run your dCount against that query:

 
i = DCount("RecordLock", "qryInvoice", "ContractNumber =" & Chr(34) & _
                    gContractID & Chr(34) & " and RecordLock = 0")

Open in new window


Alternatively, embed the select statement in VBA and use recordset code instead of DCount.
0
 

Author Closing Comment

by:Karen Schaefer
ID: 39896346
THANKS FOR GREAT ASSIST, that did it simplified my code - since I need to change all my recordsets and sql strings to look at either local tables or external tables.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question