473,396 Members | 1,784 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,396 software developers and data experts.

Object required?

111 100+
I'm getting an Object Required error when this code is run. Any ideas?

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnCabin_Click()
  2. On Error GoTo Err_btnCabin_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.     Dim intOV As Integer
  7.     Dim intInside As Integer
  8.     Dim intBalc As Integer
  9.  
  10.     stDocName = "frmNewCabins"
  11.  
  12.     stLinkCriteria = "[GroupNumber]=" & "'" & Me![GroupNumber] & "'"
  13.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  14.  
  15.     intOV = DCount(tblManifest.[ID], tblManifest, tblManifest.[Category] = "OV")
  16.     intInside = DCount([tblManifest.ID], tblManifest, tblManifest.[Category] = "Inside")
  17.     intBalc = DCount([tblManifest.ID], tblManifest, tblManifest.[Category] = "Balcony")
  18.  
  19.     Forms![frmNewCabins]![OVAmt] = Forms![frmCabins]![OVAmt] - intOV
  20.     Forms![frmNewCabins]![InsideAmt] = Forms![frmCabins]![InsideAmt] - intInside
  21.     Forms![frmNewCabins]![BalconyAmt] = Forms![frmCabins]![BalconyAmt] - intBalc
  22.  
  23.  
  24. Exit_btnCabin_Click:
  25.     Exit Sub
  26.  
  27. Err_btnCabin_Click:
  28.     MsgBox Err.Description
  29.     Resume Exit_btnCabin_Click
  30.  
  31. End Sub
Aug 17 '07 #1
1 2653
Rabbit
12,516 Expert Mod 8TB
The correct syntax for DCount is:
Expand|Select|Wrap|Line Numbers
  1. DCount("[Field Name]", "[Table Name]", "[Text Field] = 'Some String'")
Including the quotes.
Aug 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ian Pilcher | last post by:
Howdy all! I'm working with XML schemas for the first time, so please be gentle! I am working on a graphics program (in Java if it matters), and I have decided to use XML files to store the...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
6
by: Richard Steele | last post by:
I have a static object that gets referenced at application startup. This object stores a dataset and various strings to be used whenever required. This object may be called at anytime to provide...
9
by: Remulac | last post by:
Hello, I'm trying to get the value out of a dropdown list box and assign it to a variable. When I click on the list box, I invoke this line of code. I get the error, "Object reference not set...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
14
by: julie.siebel | last post by:
I've been wrestling with a really complex page. All the data is drawn down via SQL, the page is built via VBScript, and then controlled through javascript. It's a page for a travel company that...
1
by: Dave | last post by:
I have multiple forms that will create an object. Basically a energy efficiency measure object. The measure object will have a couple of required properties set but after that it can have 10-20...
4
by: ink | last post by:
Hi All I am relatively new to doing this and i think that i am making some king of school boy error. The error i am getting is on the following line of code. XmlSerializer xs = new...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.