Dcount Help

bleep-blop

Registered User.
Local time
Today, 21:04
Joined
Sep 30, 2013
Messages
24
Hi,

Trying to get a Dcount to work. My code so far (not working)

Code:
DCount("OracleID", "TblEmpAb", "(OracleID = '" & txtOracleID & "'" & " AND AbStart =#" & Me.txtAbStart & "#")

Im using this VBA to prevent a new absence case being created if the employee selected already has a case open.

OracleID is a string
Abstart is a date

Been running round in circles.

Any help would be appreciated.
 
You say it does not work. Can you more specific.
Try:
Code:
DCount("OracleID", "TblEmpAb", "(OracleID = '" & txtOracleID & "' AND AbStart =#" & Me.txtAbStart & "#")
 
Hello bleep-blop, Welcome to AWF. :)

I think the problem you are facing would be the International Access Date problem, try formatting the Date entry..
Code:
DCount("OracleID", "TblEmpAb", "OracleID = '" & txtOracleID & "' AND AbStart = #" & Format(Me.txtAbStart, "mm\/dd\/yyyy") & "#")
Also you had an Opening parentheses before OracleID, and but did not close it.
 
try

Code:
DCount("OracleID", "TblEmpAb", "[OracleID] = '" & txtOracleID & "' AND [AbStart] = #" & Me.txtAbStart & "#")
 
Thanks for all the responses. It was counting 0 when I knew the criteria should count 5.

PR2-eugin your code worked straight away.

Thanks all :) :):)
 
Hi

Couldn't you simply create a report to check for open cases? You could challenge that query with a VBA record set and fine tune it quite easily.

Nigel
 

Users who are viewing this thread

Back
Top Bottom