Microsoft
Software
Hardware
Network
Question : Problem with DCount in VBA using a variable for a table name enbedded in a form
Hello.. Having problem with DCount in VBA.
I have a form that has a hidden variable, txtMasterTable, that contains a table name. I want to count the number of records in that table using DCount. This works when I hard code the table name. However, when I use Me.txtMasterTable it is not working. I suspect this is just a quote placement issue?? Code below, thanks in advance:
MsgBox DCount("*", "& """ & Me.txtMasterTable & """ &", "[Invalid Contract] =0 And [MissingContract] = 0 and DateTimeSubmittedtoDB = #" & Me.txtDateTime & "#")
Answer : Problem with DCount in VBA using a variable for a table name enbedded in a form
Try this:
MsgBox DCount("*", Me.txtMasterTable, "[Invalid Contract] =0 And [MissingContract] = 0 and DateTimeSubmittedtoDB = #" & Me.txtDateTime & "#")
Random Solutions
SQL - Find records in one table not in another
Form update in Access 2007
VBA querytables.refresh not working
Reading dBase files with attached MDX via ADO.NET
Cannot Install SP4 on Windows 2000 Server
how do I reopen a closed company that was accidently closed in Microsoft Great Plains 10
reverse string using SQL function
Outlook error 0x80040109 -
dsquery / dsget - different results, not able to pass results to dsget
How to email an Access 2002 report in pdf format