Examine 1 field and and adjust another field accordingly

  • Thread starter Thread starter ChrisK
  • Start date Start date
C

ChrisK

I havent done much programming in Access, and I'm drawing a blank. I want a
procedure to examine an numeric field and depending on the value in that
field I want to fill in a currency field with a value. I know its pretty
simple but I am drawing a blank. Because I am dealing with only 4 fill in
values I am not storing those values in a seperate table, I will just include
the values in the procedure.
 
try something like this in the form OnCurrent event

Dim intNbr as Integer
switch(intNbr=1, .25,intNbr=2, .50,intNbr=3, .1.00, intNbr=4, 1.50)

you may have to play with the value as a string...
Dim strNbr as String... strNbr = "1",.25, ...
 
I think I got it but I have 2 other requirements, the fill in value will be
placed in a seperate field named "cprice" and I was trying to run this in
table view and have it step down through 2700 +/- records
 
well... someone else may have a better idea but in that case I would make a
query with a field like:

cprice: Switch([NbrField]="1",0.25,[NbrField]="2",0.50, ... view the query
like that.

unless there's a specific need to store that value in a table, I would treat
it as a calculated field.
 
Thanks its works great in the query, is there a way to display the final
figure a currency?

Maarkr said:
well... someone else may have a better idea but in that case I would make a
query with a field like:

cprice: Switch([NbrField]="1",0.25,[NbrField]="2",0.50, ... view the query
like that.

unless there's a specific need to store that value in a table, I would treat
it as a calculated field.


ChrisK said:
I think I got it but I have 2 other requirements, the fill in value will be
placed in a seperate field named "cprice" and I was trying to run this in
table view and have it step down through 2700 +/- records
 

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

Back
Top