sir,
i am struggling with a problem in my code.The code is
Dim subcode as Variant,intnoofsubquestions(4) as integer,i as integer
subcode = Array("ma","phy","che","ece")
'Msgbox myArray(2) is giving che .up to here no problem
the next line is
For i= 0 to 3
intnoofsubquestions(i)=Dcount("*","tablename","[subcode] = 'subcode(i)' ")
...........It is not taking subcode(0) as ma when i=0. not getting noofsubquestions from table. when i=1,2,3 also like that problem
when i write in Dcount function "[subcode]='ma' " then i am getting.
how to do this
please help me
thanks in advance
5 1538
What this does is tell it to count if [subcode] is equal to the text subcode(i). - Dcount("*","tablename","[subcode] = 'subcode(i)' ")
What you want, assuming that subcode is numeric, is: - Dcount("*","tablename","[subcode] = " & subcode(i))
dim subcode as variant,i as integer,intAvailablesubQuestions()as integer
subcode = Array("ma", "phy", "che", "ece")
for i=0 to 3
intAvailablesubQuestions(i) = DCount("*", "tblexam", "[subcode] = 'ma'")
with the above line i am getting no. of questions.
But in my code
intAvailablesubQuestions(i) = DCount("*", "tblexam", "[subcode] = " & subcode(i))
with the next line i am not getting no. of questions. it is giving no. of questions as 0.
please help me.
That's for numeric variables, if you're looking at a text value, you want: - Dcount("*","tablename","[subcode] = '" & subcode(i) & "'")
thank u that is working.
But - intNumberOfsubTestQuestions(i) = DLookup("numofques", "Table2", "[subcode] = '" & subcode(i) & "'" And "[tstid]= '" & Combo13 & "'")
numofques is number field in table2,tstid is the combobox.
i am getting type mismatch error
please help me
thank u that is working.
But - intNumberOfsubTestQuestions(i) = DLookup("numofques", "Table2", "[subcode] = '" & subcode(i) & "'" And "[tstid]= '" & Combo13 & "'")
numofques is number field in table2,tstid is the combobox.
i am getting type mismatch error
please help me
The And logical operator is outside the string when it should be a part of it: - intNumberOfsubTestQuestions(i) = DLookup("numofques", "Table2", "[subcode] = '" & subcode(i) & "' And [tstid]= '" & Combo13 & "'")
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
by: Simon Matthews |
last post by:
Hope someone can help an Access beginner!
I've just started keeping my surgical logbook on access and it's a
simple flat-file affair. I have created several queries that will
list cases...
|
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...
|
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...
|
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...
|
by: Paul T. RONG |
last post by:
Hi,
I have a problem with DCount, the following code doesn't work:
DCount("", "qryOrder", "( = Me! AND
= 'drink')" > 0
Please help.
Thank you.
|
by: Bruce Lawrence |
last post by:
I'm running Access 97 and my modules are looping if someone puts an
invalid value in.
The setup:
3 macros - get_clock_num, verify_clocknum, append_to_history
3 functions. each in their own...
|
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...
|
by: iBasho |
last post by:
Hi
I am using the DCount function to check and alert users for existing IDs in my database after a new record is entered.
..Private Sub CARDID_AfterUpdate()
If DCount("*", "", " = '" & Me. &...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |