A lot of repetative code

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
 
M

Mike Painter

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.
 
P

PC Datasheet

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.
 

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

Top