473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Syntax in DCount function

FrmBookings is a subform linked to the form FrmParty. The DCount function
checks for previous bookings and it works fine but why do I need such a
long-winded syntax ie Forms![FrmParty].Form![FrmBookings]![EventDate] in the
conditon part of the Dcount.

Private Sub SessionCode_BeforeUpdate(Cancel As Integer)

If DCount("[EventDate]", "TblBookings", "[EventDate] =
Forms![FrmParty].Form![FrmBookings]![EventDate]") > 0 Then

MsgBox ("Sorry this is already booked out!")
End If

End Sub

How can I slim down this line? Me.[EventDate] does not work - why?

Many thanks Geoff
Mar 12 '06 #1
1 1895
Geoff wrote:
FrmBookings is a subform linked to the form FrmParty. The DCount function
checks for previous bookings and it works fine but why do I need such a
long-winded syntax ie Forms![FrmParty].Form![FrmBookings]![EventDate] in the
conditon part of the Dcount.

Private Sub SessionCode_BeforeUpdate(Cancel As Integer)

If DCount("[EventDate]", "TblBookings", "[EventDate] =
Forms![FrmParty].Form![FrmBookings]![EventDate]") > 0 Then

MsgBox ("Sorry this is already booked out!")
End If

End Sub

How can I slim down this line? Me.[EventDate] does not work - why?

Many thanks Geoff


Geoff, you didn't indicate where that code resides, but I'm guessing
that is in the FrmParty code module and SessionCode is a control on that
form. Assuming that to be the case, EventDate is a control on another
form. Yes, even though it is a subform of FrmParty, FrmBookings is a
different form. "Me." only points to the immediate form.

You could shorten it slightly to:

Me!FrmBookings.Form!EventDate

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Mar 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: jdph40 | last post by:
I posted this problem previously and received excellent help from Wayne Morgan. However, I still have an unanswered question. My form (frmVacationWeeks) is opened from the OnClick event of a...
1
by: Megan | last post by:
Hi Everybody- I've been reading some of the posts about DCOUNT, and I haven't yet found an answer; so, I'm posting this question. I have a report that I'm trying to use DCOUNT on to compute...
4
by: Will | last post by:
Hi, I had a DCount within a module on records in a table where CustSuffix = 0. I now need to DCount where CustSuffix = 0 and the type of cost Suffix (Suffix in table) = G. I can't get both...
6
by: Mike Conklin | last post by:
This one really has me going. Probably something silly. I'm using dcount for a report to determine the number of different types of tests proctored in a semester. My report is based on a...
3
by: BerkshireGuy | last post by:
I am having difficulty with using the Dcount function. I am trying to return the number of records from qryIndividualFeedbackDetail where the TimelyManner field is set to 4. So, in the new...
7
by: kaosyeti | last post by:
hey.. i have a control in a report that needs to count the records from a table that match the parameters that the user selects when creating the report. the report is created with...
2
by: ChasW | last post by:
Greetings, I have a form that uses a query as its record source. In the form I have a text box that uses this as its control source: =DCount("", "qry_Search_by_Name") The DCount function...
2
by: davy d | last post by:
I'm having a problem with an acess form linkin with another form. My index in the main form is Autonumber (Rec#) the 2nd form is called Record# and it is set for text. The link criteria works...
7
by: favor08 | last post by:
How can I tie the users shortname to this code. so it comes back with the results that only apply to them. Dim pastdue As Integer Dim current As Integer Dim tot As Integer nodate =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.