Domain Aggregate Function with AND Operator

D

Derek Wittman

Good morning
I've combed the help files and I'm still struggling with this. I'm trying to use a dmax function with an AND in the criteria (argument3). I can't tell if I am having trouble with the syntax or what. I get a RunTime Error #94, "Invalid Use of Null".

Here's the function call:
=WOCount([Forms]![frmRequest].[Divn],[Forms]![frmRequest].[Classe]

Here's my code
Public Function WOCount(di As String, cla As String) As Strin
Dim strcstr As Strin
strcstr = "division = divn AND classe = classe" ' I used the strcstr because I'd like to eventually convert WOCount into
'string with formatting of "00000" - another challenge I'm having is that the Excel TEXT function doesn't seem to work her
WOCount = DLast("[WOID]", "tblRequests", strcstr) +
End Functio

divn and classe are both textbox control values on my form. Ultimately, the WOID will look like this DD-C-WWWWW where DD is a division abbreviation (always 2 letters), C is the Classification left(classification,1) of Building, Electrical, Plumbing, Refrigeration, etc, and WWWWW is the text version of the Work Order

Can someone please help? Thank you very much in advance
Derek
 
C

Chris Nebinger

Try Right("00000" & WOID,5)


Chris Nebinger

-----Original Message-----
Okay... I was able to get the first answer on my own. I
changed my thought process a bit based on what I really
needed (and not what I was hoping for). But the 2nd
question (the one about the converting to text formatting,
basically, I'd like leading zeroes for my number/text so
that 1 is 00001 and 1000 is 01000...) still stumps me.
Anyone?
Thank you in advance!
Derek

----- Derek Wittman wrote: -----

Good morning,
I've combed the help files and I'm still struggling
with this. I'm trying to use a dmax function with an AND
in the criteria (argument3). I can't tell if I am having
trouble with the syntax or what. I get a RunTime Error
#94, "Invalid Use of Null".
Here's the function call:
=WOCount([Forms]![frmRequest].[Divn],[Forms]! [frmRequest].[Classe])

Here's my code:
Public Function WOCount(di As String, cla As String) As String
Dim strcstr As String
strcstr = "division = divn AND classe = classe" ' I
used the strcstr because I'd like to eventually convert
WOCount into a
'string with formatting of "00000" - another
challenge I'm having is that the Excel TEXT function
doesn't seem to work here
WOCount = DLast("[WOID]", "tblRequests", strcstr) + 1
End Function

divn and classe are both textbox control values on
my form. Ultimately, the WOID will look like this DD-C-
WWWWW where DD is a division abbreviation (always 2
letters), C is the Classification left(classification,1)
of Building, Electrical, Plumbing, Refrigeration, etc, and
WWWWW is the text version of the Work Order.
 
D

Derek Wittman

Thanks, Chris. I'm intrigued. I've never seen it quite like that. But after looking it over a few minutes, it makes sense.

I ended up trying Format(WOID,"00000") which worked. It seems that there is more than 1 way to develop a database - although some are better than others. I tend to do things the hard way

Thanks again
Dere

----- Chris Nebinger wrote: ----

Try Right("00000" & WOID,5


Chris Nebinge

-----Original Message----
Okay... I was able to get the first answer on my own. I
changed my thought process a bit based on what I really
needed (and not what I was hoping for). But the 2nd
question (the one about the converting to text formatting,
basically, I'd like leading zeroes for my number/text so
that 1 is 00001 and 1000 is 01000...) still stumps me.
Anyone
I've combed the help files and I'm still struggling
with this. I'm trying to use a dmax function with an AND
in the criteria (argument3). I can't tell if I am having
trouble with the syntax or what. I get a RunTime Error
#94, "Invalid Use of Null".
Here's the function call: =WOCount([Forms]![frmRequest].[Divn],[Forms] [frmRequest].[Classe]
Here's my code
Public Function WOCount(di As String, cla As String) As Strin
Dim strcstr As Strin
strcstr = "division = divn AND classe = classe" ' I
used the strcstr because I'd like to eventually convert
WOCount into
'string with formatting of "00000" - another
challenge I'm having is that the Excel TEXT function
doesn't seem to work her
WOCount = DLast("[WOID]", "tblRequests", strcstr) +
End Functio
divn and classe are both textbox control values on
my form. Ultimately, the WOID will look like this DD-C
WWWWW where DD is a division abbreviation (always 2
letters), C is the Classification left(classification,1)
of Building, Electrical, Plumbing, Refrigeration, etc, and
WWWWW is the text version of the Work Order
 
C

Chris Nebinger

There's many ways to do everything. This is the way I've
used in the past, and its simple.

Good luck in your project.


Chris Nebinger

-----Original Message-----
Thanks, Chris. I'm intrigued. I've never seen it quite
like that. But after looking it over a few minutes, it
makes sense.
I ended up trying Format(WOID,"00000") which worked. It
seems that there is more than 1 way to develop a database -
although some are better than others. I tend to do
things the hard way.
Thanks again!
Derek

----- Chris Nebinger wrote: -----

Try Right("00000" & WOID,5)


Chris Nebinger

-----Original Message-----
Okay... I was able to get the first answer on my
own. I
changed my thought process a bit based on what I really
needed (and not what I was hoping for). But the 2nd
question (the one about the converting to text formatting,
basically, I'd like leading zeroes for my number/text so
that 1 is 00001 and 1000 is 01000...) still stumps me.
Anyone?
I've combed the help files and I'm still
struggling
with this. I'm trying to use a dmax function with an AND
in the criteria (argument3). I can't tell if I am having
trouble with the syntax or what. I get a RunTime Error
#94, "Invalid Use of Null".
Here's the function call: =WOCount([Forms]![frmRequest].[Divn],[Forms]! [frmRequest].[Classe])
Here's my code:
Public Function WOCount(di As String, cla As
String)
As String
Dim strcstr As String
strcstr = "division = divn AND classe =
classe" ' I
used the strcstr because I'd like to eventually convert
WOCount into a
'string with formatting of "00000" - another
challenge I'm having is that the Excel TEXT function
doesn't seem to work here
WOCount = DLast("[WOID]", "tblRequests", strcstr) + 1
End Function
divn and classe are both textbox control
values on
my form. Ultimately, the WOID will look like this DD-C-
WWWWW where DD is a division abbreviation (always 2
letters), C is the Classification left (classification,1)
of Building, Electrical, Plumbing, Refrigeration, etc, and
WWWWW is the text version of the Work Order. in
advance!
Derek
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cannot Call Function 7

Top