A lot of repetative code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

i am having database with a lot of repetative code without the command buttons. Is there a way to reduce repetative code. Can I put it in module or function and just call it when I need it. Can someone give me an example. Thanks a lot.

In addition I have the continious form showing records. I would like to put a check box or something similar for selecting records and then use that selections as a records filter for report. Is this possible and if it is please let me know how.

Thanks a lot for your time

Senad
 
Senad said:
Hi All,

i am having database with a lot of repetative code without the command
buttons. Is there a way to reduce repetative code. Can I put it in module or
function and just call it when I need it. Can someone give me an example.
Thanks a lot.

Yes you can put it in a module and call it. There are tons of examples in
help and the Northwind Database.
In addition I have the continious form showing records. I would like to
put a check box or something similar for selecting records and then use that
selections as a records filter for report. Is this possible and if it is
please let me know how.Base your report on a query which prints only values which are checked.
I usually use one or more forms in a datasheet view but a continuous for
will work.
I also have buttons one which run a "select all" and another a "clear all"
query.
 
Repetitive Code ----------------
Put the following in a standard module:
Public Sub MyRepetitiveCode()

<Your Repetitive Code >

End Sub
Everywhere you want to execute the code, enter: Call MyRepetitiveCode()

Check Box:
Add a field named Selected to your table and make it Yes/No DataType.
Include Selected in the basis of your continuous form.
Create another query for your report and include Selected. Enter True for the
criteria of Selected.
In the close event of the report, execute an update query that sets the value of
Selected back to False.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


Senad said:
Hi All,

i am having database with a lot of repetative code without the command
buttons. Is there a way to reduce repetative code. Can I put it in module or
function and just call it when I need it. Can someone give me an example. Thanks
a lot.
In addition I have the continious form showing records. I would like to put a
check box or something similar for selecting records and then use that
selections as a records filter for report. Is this possible and if it is please
let me know how.
 
Back
Top