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
The data types nvarchar and uniqueidentifier are incompatible in the add operator.
Access SQL Join Statement in VBA - Help
Inserting XML data int an nText field in SQL 2005
How to explore disk raiding status in Win2k3Server
Create report out of crosstab where column name changes
Can't save Access 2003 report with specific printer under Access 2007
Microsoft, Access, 2007, Prevent exclusive locking of linked table
How can i hide root level of TreeView in Silverlight?
MS Access 2003 ... Add customized code to form created by Wizard
Restrict Formatting & Editing, Start Enforcement Option not Available