Event Help

  • Thread starter Thread starter Tom
  • Start date Start date
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 .



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
 
Tom,
Your code looks OK. Try placing it in the OnFormat event of the report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
I tried that Al an no change...I have written these before and they worked
by clicking a field for example if i had a checkbox field that indicated if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never gives me an
after update event for some reason

Thanks again
for any light you can shed on this problem
Al Campagna said:
Tom,
Your code looks OK. Try placing it in the OnFormat event of the report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

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 .



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
 
Tom,
You wrote...
I have written these before and they worked
by clicking a field for example if i had a checkbox field that indicated
if and
and then going to the on update field property and entering the code

There is no such thing as "clicking a field", or AfterUpdate... as
regards a report.

Is there a form open at the time of the report, that the report will use
to make some determination as to restocking?
If so, please describe that form, and the fields involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Tom said:
I tried that Al an no change...I have written these before and they worked
by clicking a field for example if i had a checkbox field that indicated
if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never gives me
an
after update event for some reason

Thanks again
for any light you can shed on this problem
Al Campagna said:
Tom,
Your code looks OK. Try placing it in the OnFormat event of the
report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

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 .



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
 
No other form or query is open except this report which is based on teh query
where the calculation takes place.

Thanks

Tom

Al Campagna said:
Tom,
You wrote...
I have written these before and they worked
by clicking a field for example if i had a checkbox field that indicated
if and
and then going to the on update field property and entering the code

There is no such thing as "clicking a field", or AfterUpdate... as
regards a report.

Is there a form open at the time of the report, that the report will use
to make some determination as to restocking?
If so, please describe that form, and the fields involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Tom said:
I tried that Al an no change...I have written these before and they worked
by clicking a field for example if i had a checkbox field that indicated
if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never gives me
an
after update event for some reason

Thanks again
for any light you can shed on this problem
Al Campagna said:
Tom,
Your code looks OK. Try placing it in the OnFormat event of the
report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

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 .



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
 
Tom,
Were missing something here...
Let's assume that [todays inventory] and [restock level] and
[restockmsg] are in your report's detail section.
Also, both [todays inventory] and [restock level] are "bound" text
controls.
And [restockmsg] is a hard wired label, with a common text string.

You indicated [Event Procedure] in the Detail Section's OnFormat event,
and placed my code in the report's module?
And you got no errors, and nothing happened to either [restockmsg] or
[restock level]?

The code I posted, placed in the OnFormat event of the report's Detail
Section, should work.

If your DB isn't too large, you can zip it and send it to me via my
website (below)
In your email include the word "newsgroup" in the subject, and in the
body, tell me what version your running, and the report name where the
problem occurs.
Confidentiality is insured...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Tom said:
No other form or query is open except this report which is based on teh
query
where the calculation takes place.

Thanks

Tom

Al Campagna said:
Tom,
You wrote...
I have written these before and they worked
by clicking a field for example if i had a checkbox field that
indicated
if and
and then going to the on update field property and entering the code

There is no such thing as "clicking a field", or AfterUpdate... as
regards a report.

Is there a form open at the time of the report, that the report will
use
to make some determination as to restocking?
If so, please describe that form, and the fields involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

Tom said:
I tried that Al an no change...I have written these before and they
worked
by clicking a field for example if i had a checkbox field that
indicated
if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never gives
me
an
after update event for some reason

Thanks again
for any light you can shed on this problem
:

Tom,
Your code looks OK. Try placing it in the OnFormat event of the
report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm
sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

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 .



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
 
That would be most helpful. I guess my main question is why I don't have an
after update event because if I did have one of those I could attach the code
to that. I even included a checkbox and tried attaching the code to the after
update event of the checkbox . The checkbox indicateed that the item needed
restocked. There just don't seem to be any after update events which I find
puzzling. What dictates the availabiliy of an after update event. Is it the
field type or what?


Thanks again

Tom

Al Campagna said:
Tom,
Were missing something here...
Let's assume that [todays inventory] and [restock level] and
[restockmsg] are in your report's detail section.
Also, both [todays inventory] and [restock level] are "bound" text
controls.
And [restockmsg] is a hard wired label, with a common text string.

You indicated [Event Procedure] in the Detail Section's OnFormat event,
and placed my code in the report's module?
And you got no errors, and nothing happened to either [restockmsg] or
[restock level]?

The code I posted, placed in the OnFormat event of the report's Detail
Section, should work.

If your DB isn't too large, you can zip it and send it to me via my
website (below)
In your email include the word "newsgroup" in the subject, and in the
body, tell me what version your running, and the report name where the
problem occurs.
Confidentiality is insured...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Tom said:
No other form or query is open except this report which is based on teh
query
where the calculation takes place.

Thanks

Tom

Al Campagna said:
Tom,
You wrote...
I have written these before and they worked
by clicking a field for example if i had a checkbox field that
indicated
if
and
and then going to the on update field property and entering the code

There is no such thing as "clicking a field", or AfterUpdate... as
regards a report.

Is there a form open at the time of the report, that the report will
use
to make some determination as to restocking?
If so, please describe that form, and the fields involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."


I tried that Al an no change...I have written these before and they
worked
by clicking a field for example if i had a checkbox field that
indicated
if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never gives
me
an
after update event for some reason

Thanks again
for any light you can shed on this problem
:

Tom,
Your code looks OK. Try placing it in the OnFormat event of the
report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm
sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

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 .



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
 
Tom,
A report does not have control level "events"... just events that
pertain to the report itself.
The OnFormat event of a report section is the place to apply any
logic... as to what shows, what colors, etc...
Think of OnFormat as a chance to "manually" Conditional Formatting to
your report controls.

Also, in Access 2003 and up, you actually have real Conditional
Formatting availabe on report controls.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Tom said:
That would be most helpful. I guess my main question is why I don't have
an
after update event because if I did have one of those I could attach the
code
to that. I even included a checkbox and tried attaching the code to the
after
update event of the checkbox . The checkbox indicateed that the item
needed
restocked. There just don't seem to be any after update events which I
find
puzzling. What dictates the availabiliy of an after update event. Is it
the
field type or what?


Thanks again

Tom

Al Campagna said:
Tom,
Were missing something here...
Let's assume that [todays inventory] and [restock level] and
[restockmsg] are in your report's detail section.
Also, both [todays inventory] and [restock level] are "bound" text
controls.
And [restockmsg] is a hard wired label, with a common text string.

You indicated [Event Procedure] in the Detail Section's OnFormat
event,
and placed my code in the report's module?
And you got no errors, and nothing happened to either [restockmsg] or
[restock level]?

The code I posted, placed in the OnFormat event of the report's
Detail
Section, should work.

If your DB isn't too large, you can zip it and send it to me via my
website (below)
In your email include the word "newsgroup" in the subject, and in the
body, tell me what version your running, and the report name where the
problem occurs.
Confidentiality is insured...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."

Tom said:
No other form or query is open except this report which is based on teh
query
where the calculation takes place.

Thanks

Tom

:

Tom,
You wrote...
I have written these before and they worked
by clicking a field for example if i had a checkbox field that
indicated
if
and
and then going to the on update field property and entering the
code

There is no such thing as "clicking a field", or AfterUpdate... as
regards a report.

Is there a form open at the time of the report, that the report
will
use
to make some determination as to restocking?
If so, please describe that form, and the fields involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your
life."


I tried that Al an no change...I have written these before and they
worked
by clicking a field for example if i had a checkbox field that
indicated
if
checked a reorder was necessary

and then going to the on update field property and entering the code

I added such a checkbox to the table and the report but it never
gives
me
an
after update event for some reason

Thanks again
for any light you can shed on this problem
:

Tom,
Your code looks OK. Try placing it in the OnFormat event of
the
report
section that prints the stocking level data.
example: (your original code was missing the End If... a typo I'm
sure)
Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)
If [todays inventory] <= [restock level] Then
[restockmsg].Visible = True
[restock level].ForeColor = 255
Else
[restockmsg].Visible = False
[restock level].ForeColor = 0
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in
your
life."

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 .



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
 
That's the difference .....I believe I was working in a form and not a
report. Thanks so much!!

Tom
 
Back
Top