event help

T

Tom

I am in access 2007 and I have a table called inventory with the following
fields included:
I have a field called [restock level] and it is numeric
a field called [current purchases] which is numeric
and a field called [current inventory level] which is numeric

I created a query and included a calculated field called todays inventory
which subtracts [current purchases] from the [current inventory level]

I created a report based on the inventory query . it could just as easily be
a form



In that report I would like a message to display if the number in [todays
inventory] is less than or equal to the [restock level]

i created a warning label saying that reorder immmediately
I named the label restockmsg

I made some simple code and tried to attach it to the todays inventory field

If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End Sub

I would like to attach it to the after update field but there is no after
update field in the events . I am not sure wheer I have gone wrong.

Any suggestions would be appreciated
Thanks
Tom
 
C

Clifford Bass

Hi Tom,

Put it in the Detail section's On Format event. You may also want to
check out the conditional formatting option (Report Design Tools, Design
ribbon, Font section).

Clifford Bass
 
T

Tom

I'll give that a try
Thanks
Clifford Bass said:
Hi Tom,

Put it in the Detail section's On Format event. You may also want to
check out the conditional formatting option (Report Design Tools, Design
ribbon, Font section).

Clifford Bass

Tom said:
I am in access 2007 and I have a table called inventory with the following
fields included:
I have a field called [restock level] and it is numeric
a field called [current purchases] which is numeric
and a field called [current inventory level] which is numeric

I created a query and included a calculated field called todays inventory
which subtracts [current purchases] from the [current inventory level]

I created a report based on the inventory query . it could just as easily be
a form



In that report I would like a message to display if the number in [todays
inventory] is less than or equal to the [restock level]

i created a warning label saying that reorder immmediately
I named the label restockmsg

I made some simple code and tried to attach it to the todays inventory field

If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End Sub

I would like to attach it to the after update field but there is no after
update field in the events . I am not sure wheer I have gone wrong.

Any suggestions would be appreciated
Thanks
Tom
 
T

Tom

I tried that Clifford but the message stills displays even when the restock
level is not less than the todays inventory field. I only want the warning
when it violates that.



Clifford Bass said:
Hi Tom,

Put it in the Detail section's On Format event. You may also want to
check out the conditional formatting option (Report Design Tools, Design
ribbon, Font section).

Clifford Bass

Tom said:
I am in access 2007 and I have a table called inventory with the following
fields included:
I have a field called [restock level] and it is numeric
a field called [current purchases] which is numeric
and a field called [current inventory level] which is numeric

I created a query and included a calculated field called todays inventory
which subtracts [current purchases] from the [current inventory level]

I created a report based on the inventory query . it could just as easily be
a form



In that report I would like a message to display if the number in [todays
inventory] is less than or equal to the [restock level]

i created a warning label saying that reorder immmediately
I named the label restockmsg

I made some simple code and tried to attach it to the todays inventory field

If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End Sub

I would like to attach it to the after update field but there is no after
update field in the events . I am not sure wheer I have gone wrong.

Any suggestions would be appreciated
Thanks
Tom
 
C

Clifford Bass

Hi Tom,

Are the actual [todays inventory] and [restock level] fields on the
report also named the same as their sources? If not, use the names of the
fields. You could put a break point in the code on the If line and when it
breaks, inspect the actual values of those fields in code by hovering your
cursor over them. If the condition is true, use Shift-F8 to step through the
code to see what is happening. Otherwise when false, press F5 to continue.
It may be useful to limit your report temporarily to just the records where
the message should display. Then you don't have to deal with it stopping
umpteen times before you get to an actual case.

Hope that helps,

Clifford Bass
 
T

Tom

Yes they are the same...the conditional formattiing idea works but I would
still liike the user to have a warning message in case they are color blind
etc.

Thanks
tom
 
B

Beetle

Is the label also in the Detail section, repeated for every row?

Another option would be to add another calculated field to your query like;

IIf([todays inventory]<=[restock level], "Re-Order Immediately", "")

Then use a text box on your report, bound to this calculated quey field.
--
_________

Sean Bailey


Tom said:
Yes they are the same...the conditional formattiing idea works but I would
still liike the user to have a warning message in case they are color blind
etc.

Thanks
tom

Tom said:
I am in access 2007 and I have a table called inventory with the following
fields included:
I have a field called [restock level] and it is numeric
a field called [current purchases] which is numeric
and a field called [current inventory level] which is numeric

I created a query and included a calculated field called todays inventory
which subtracts [current purchases] from the [current inventory level]

I created a report based on the inventory query . it could just as easily be
a form



In that report I would like a message to display if the number in [todays
inventory] is less than or equal to the [restock level]

i created a warning label saying that reorder immmediately
I named the label restockmsg

I made some simple code and tried to attach it to the todays inventory field

If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End Sub

I would like to attach it to the after update field but there is no after
update field in the events . I am not sure wheer I have gone wrong.

Any suggestions would be appreciated
Thanks
Tom
 
C

Clifford Bass

Hi Tom,

Sean's first point is important. If the message is in a header or
footer, then it most likely is impacted by the last item encountered in the
report. If it is already in the detail, let us know.

Clifford Bass
 
T

Tom

The label was in the detail sectio should i move it to a header or footer?

Clifford Bass said:
Hi Tom,

Sean's first point is important. If the message is in a header or
footer, then it most likely is impacted by the last item encountered in the
report. If it is already in the detail, let us know.

Clifford Bass

Beetle said:
Is the label also in the Detail section, repeated for every row?

Another option would be to add another calculated field to your query like;

IIf([todays inventory]<=[restock level], "Re-Order Immediately", "")

Then use a text box on your report, bound to this calculated quey field.
 
C

Clifford Bass

Hi Tom,

No. Leave it in the detail. That is where is should be. Do I take it
that it is working now? Or is there still the message for all rows?

Clifford Bass
 
T

Tom

using the IIF function it now works but any other way , it displays the
message all the time..

Thanks again for the suggestion

Tom
 
C

Clifford Bass

Hi Tom,

You are welcome. It is a bit odd, but since you got one method to
work, that is really all that counts.

Clifford Bass
 
T

Tom

Yes that is all that counts. I was just curious as to why there was no after
update command available on the tab for the label I created since I have done
this before. I even included a checkbox field and there was no after update
event for that either. What dicxtates the availabaility of an after update
event/ Is it only certain types of fields?

Thanks again
Tom
 
C

Clifford Bass

Hi Tom,

Labels do not have events when connected to other controls. But do
when not connected. They would not have an after update since they are not
something the user modifies. Controls on a report do not have update events
since they are only reporting. At least that is my understanding.

Clifford Bass
 
B

Beetle

There is no After Update event for controls on a report, because
they cannot be updated. Reports only display/print data, they do not
allow updates by the user.

You're thinking of the After Update event for controls on a form, which
are designed for user input/updating. However, labels do not have an
After Update event , even on forms, because they are only for
display. You can update/change their value programmatically, but the
After Update event is related to user updates, not programmatic updates.

Form controls that can actually be updated by the user have After Update
events. The form itself also has an After Update event.
 
T

Tom

That was the problem. Ihad done it on a form not on a report. Thanks for
clearing that up.

Tom
 
T

Tom

That cleared it up . I really appreciate the help. You guys provide a
fantastic service. Thanks again to all of you

Tom
 

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

Event Help 8
Help with Creating a Database. 2
Access 2007 0
how to relate tables 5
Duplicate records in split database 5
HELP!!! 1
Help required on VBA Coding for Access 2013 0
setting up a form or table? 3

Top