Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCount in a Procedure gone A Rye

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
I have a procedure where I am using a couple of DCount statements to validate data and automate the data entry. The first one works correctly and if everthing is true it fills in a textbox with my LogOn and puts the date in another textbox, if all is not true I get a message. This is what is working:
If DCount("[LogOn]", "tblAuthorizedUsers", "[LogOn]='" & fOSUserName & "' And [ApdCCD] = True") = 0 Then
I have a similar second line that is not working, but it is giving me an error message, no debugger, "Access can't find 'txtField1' in the procedure." Now that is fine, except that txtField1 appears in only one line of code in the entire dbase, and that line is in a procedure in another form and the two procedure have not one thing incommon. This is the second line:
If DCount("[LogOn]", "tblAuthorizedUsers", "[LogOn]='" & fOSUserName & "' And [ApdAsy] = True And [EMailAddress] = '" & [EMailAddress] & "'") = 1 Then
This is just getting e-mail addresses. Can anyone point out to me what is wrong with the second line of code? I have been looking at this for about 3/4 of a day now, and I must be blind, but I can not see anything wrong. Thank you in advance to anyone rendering some assistnace.
 
Never mind, I accidently discovered the problem. The Dim for some reason was screwing everything up. I changed to DLookUp and everything started working. Go figure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top