C
clemson726
I need to know how to set a value in a table when a form is printed (or
closed). What I am trying to do is create a work request database that
allows user entry as well as automatic work requests when certain conditions
exist. The way that i am doing this is by using "tbl_work_request" as the
control source of a form. When that form is printed, another form is called
up "frm_PM" that auto-populates a preventative maintenance work request if
[count] = 150,000 and prints that form as well. If the work request field is
null, it doesn't print. All of that works fine. My problem is that I
only want the PM form to print once. [count] = 150,000 if the real count is
between 150,000 and 349,999. In other words, if the real count is equal to
150,250, or 300,000, etc, then [count] = 150,000 for each of them. With that
happening, when "frm_PM" opens, it is going to print a preventative
maintenance work request each time even though there should only be one
request per 150,000. What i am looking to do is put some code into an
onclose event that sets the value of [check1] to "PRINTED" in the table
"tbl_tooling" if [count] = 150,000 and [work requested] is not null in the
form "frm_PM". Also, after [count]=3 million and [check20] = "PRINTED",
then all fields [check1] through [check20] should be reset to null. I've
tried to do it several different ways, but it seems like some VB code is all
that is going to work.
Some other information that may be useful:
tbl_tooling has hundreds of records in it. control source is
"tbl_work_request"
tbl_work_request is the table that i'm adding data to. control source is
"tbl_work_request"
closed). What I am trying to do is create a work request database that
allows user entry as well as automatic work requests when certain conditions
exist. The way that i am doing this is by using "tbl_work_request" as the
control source of a form. When that form is printed, another form is called
up "frm_PM" that auto-populates a preventative maintenance work request if
[count] = 150,000 and prints that form as well. If the work request field is
null, it doesn't print. All of that works fine. My problem is that I
only want the PM form to print once. [count] = 150,000 if the real count is
between 150,000 and 349,999. In other words, if the real count is equal to
150,250, or 300,000, etc, then [count] = 150,000 for each of them. With that
happening, when "frm_PM" opens, it is going to print a preventative
maintenance work request each time even though there should only be one
request per 150,000. What i am looking to do is put some code into an
onclose event that sets the value of [check1] to "PRINTED" in the table
"tbl_tooling" if [count] = 150,000 and [work requested] is not null in the
form "frm_PM". Also, after [count]=3 million and [check20] = "PRINTED",
then all fields [check1] through [check20] should be reset to null. I've
tried to do it several different ways, but it seems like some VB code is all
that is going to work.
Some other information that may be useful:
tbl_tooling has hundreds of records in it. control source is
"tbl_work_request"
tbl_work_request is the table that i'm adding data to. control source is
"tbl_work_request"