A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DH Query by Form



 
 
Thread Tools Display Modes
  #1  
Old July 8th, 2004, 11:59 PM
CS
external usenet poster
 
Posts: n/a
Default DH Query by Form

I pulled in the "applet" from Duane Hookoms link on Rogers
Access Library and I'm impressed but I ran into a little
problem with calculated fields in that they are seem to be
seen as text fields and are not evaluated correctly when
numeric criteria is given. It may not be the QBF
application at all, it could be my calculated field.
My original expression was:
B: Format(IIf(IsNull([FWHM]),"",Sqr((([FWHM]/57.3)^2)-
(0.00356)^2)),"#.0000")
Then I removed the formatting and now I get a datatype
mismatch error.
I'm stuck, I appreciate any help, thanks.
  #2  
Old July 9th, 2004, 01:24 AM
John Spencer (MVP)
external usenet poster
 
Posts: n/a
Default DH Query by Form

Using FORMAT makes the returned value a string. AND I ****THINK**** returning
"" as one of the "answers" to the IIF statement also forces everything returned
to be a string. So, I'm guessing that you might need to change the expression.

Can you use?
IIf(IsNull([FWHM]),Null,Sqr((([FWHM]/57.3)^2)-(0.00356)^2))

or perhaps?

IIf(IsNull([FWHM]),Null,CCur(Sqr((([FWHM]/57.3)^2)-(0.00356)^2)))



CS wrote:

I pulled in the "applet" from Duane Hookoms link on Rogers
Access Library and I'm impressed but I ran into a little
problem with calculated fields in that they are seem to be
seen as text fields and are not evaluated correctly when
numeric criteria is given. It may not be the QBF
application at all, it could be my calculated field.
My original expression was:
B: Format(IIf(IsNull([FWHM]),"",Sqr((([FWHM]/57.3)^2)-
(0.00356)^2)),"#.0000")
Then I removed the formatting and now I get a datatype
mismatch error.
I'm stuck, I appreciate any help, thanks.

  #3  
Old July 9th, 2004, 02:30 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default DH Query by Form

I would wrap the expression in Val() to assure the returned value is
numeric.

Glad to hear you like my QBF!

--
Duane Hookom
MS Access MVP


"John Spencer (MVP)" wrote in message
...
Using FORMAT makes the returned value a string. AND I ****THINK****

returning
"" as one of the "answers" to the IIF statement also forces everything

returned
to be a string. So, I'm guessing that you might need to change the

expression.

Can you use?
IIf(IsNull([FWHM]),Null,Sqr((([FWHM]/57.3)^2)-(0.00356)^2))

or perhaps?

IIf(IsNull([FWHM]),Null,CCur(Sqr((([FWHM]/57.3)^2)-(0.00356)^2)))



CS wrote:

I pulled in the "applet" from Duane Hookoms link on Rogers
Access Library and I'm impressed but I ran into a little
problem with calculated fields in that they are seem to be
seen as text fields and are not evaluated correctly when
numeric criteria is given. It may not be the QBF
application at all, it could be my calculated field.
My original expression was:
B: Format(IIf(IsNull([FWHM]),"",Sqr((([FWHM]/57.3)^2)-
(0.00356)^2)),"#.0000")
Then I removed the formatting and now I get a datatype
mismatch error.
I'm stuck, I appreciate any help, thanks.



  #4  
Old July 9th, 2004, 02:43 AM
Dale Fye
external usenet poster
 
Posts: n/a
Default DH Query by Form

CS,

You don't indicate which version of Access, but I just tested your code on
Access 97, and it seems to work properly, although when [FWHM] is not null,
but is small enough that [FWHM]/57.3 .00356, then I get an error because
I'm trying to take the square root of a negative number. Is there a chance
that [FWHM] is less than .203988?

I reformatted your equation and took out a couple of () that should not be
needed, to make it easier to read.

Format(IIf(IsNull([FWHM]),"",Sqr(([FWHM]/57.3)^2-0.00356^2)),"#.0000")

HTH
Dale

"CS" wrote in message
...
I pulled in the "applet" from Duane Hookoms link on Rogers
Access Library and I'm impressed but I ran into a little
problem with calculated fields in that they are seem to be
seen as text fields and are not evaluated correctly when
numeric criteria is given. It may not be the QBF
application at all, it could be my calculated field.
My original expression was:
B: Format(IIf(IsNull([FWHM]),"",Sqr((([FWHM]/57.3)^2)-
(0.00356)^2)),"#.0000")
Then I removed the formatting and now I get a datatype
mismatch error.
I'm stuck, I appreciate any help, thanks.



  #5  
Old July 9th, 2004, 04:33 PM
CS
external usenet poster
 
Posts: n/a
Default DH Query by Form

Thanks for all the help!
-----Original Message-----
I would wrap the expression in Val() to assure the

returned value is
numeric.

Glad to hear you like my QBF!

--
Duane Hookom
MS Access MVP


"John Spencer (MVP)" wrote in

message
...
Using FORMAT makes the returned value a string. AND I

****THINK****
returning
"" as one of the "answers" to the IIF statement also

forces everything
returned
to be a string. So, I'm guessing that you might need

to change the
expression.

Can you use?
IIf(IsNull([FWHM]),Null,Sqr((([FWHM]/57.3)^2)-(0.00356)

^2))

or perhaps?

IIf(IsNull([FWHM]),Null,CCur(Sqr((([FWHM]/57.3)^2)-

(0.00356)^2)))



CS wrote:

I pulled in the "applet" from Duane Hookoms link on

Rogers
Access Library and I'm impressed but I ran into a

little
problem with calculated fields in that they are seem

to be
seen as text fields and are not evaluated correctly

when
numeric criteria is given. It may not be the QBF
application at all, it could be my calculated field.
My original expression was:
B: Format(IIf(IsNull([FWHM]),"",Sqr((([FWHM]/57.3)^2)-
(0.00356)^2)),"#.0000")
Then I removed the formatting and now I get a datatype
mismatch error.
I'm stuck, I appreciate any help, thanks.



.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Display a query result in form Le Tran New Users 0 June 15th, 2004 09:08 PM
how to combine fields on a form in a query as criteria? Henro New Users 3 June 8th, 2004 03:50 PM
running a query in a form juliec Running & Setting Up Queries 1 June 8th, 2004 02:39 AM
Query Form: Print Report Dennis Running & Setting Up Queries 1 June 6th, 2004 01:08 PM
Query By Form Craig Running & Setting Up Queries 2 June 1st, 2004 01:10 AM


All times are GMT +1. The time now is 03:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.