By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,561 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

Constant in a query ?

P: n/a
Can i use a constant in a query ? I have a constant
Public Const rate As Double = 10
Can i use it in the query ? I want to multiply the field [liters] with
the constant rate, but Access does not accept the rate as a constant,
instead it always put it into brackets as it is a field. I tried to
write rate in sql, but after that access shoewed
"unknown parameter".
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
CDB
Make a public function and use it as a query field eg
FactoredLitres: getFactoredLitres([Liters])

Or, usually preferred - a factors table, and simply join to the value.

Clive
"Johm" <ke**@abv.bg> wrote in message
news:24**************************@posting.google.c om...
Can i use a constant in a query ? I have a constant
Public Const rate As Double = 10
Can i use it in the query ? I want to multiply the field [liters] with
the constant rate, but Access does not accept the rate as a constant,
instead it always put it into brackets as it is a field. I tried to
write rate in sql, but after that access shoewed
"unknown parameter".

Nov 12 '05 #2

P: n/a
Ray
ke**@abv.bg (Johm) wrote in message news:<24**************************@posting.google. com>...
Can i use a constant in a query ? I have a constant
Public Const rate As Double = 10
Can i use it in the query ? I want to multiply the field [liters] with
the constant rate, but Access does not accept the rate as a constant,
instead it always put it into brackets as it is a field. I tried to
write rate in sql, but after that access shoewed
"unknown parameter".


Hello John.

If your just trying to multiply your field [liters] by 10, which
is your constant, why not do this?

Create a new column in your query and add the following:

LitersByConstant: [Liters] * 10

This was your Liters are alway multiplied by 10 and you
don't need to set up a Public Const.

Regards,

Ray
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.