Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 16th, 2004, 04:43 PM
chimp chimp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 147 chimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 33 m 17 sec
Reputation Power: 5
checkbox help

how can i set up my form so that if i enter a date range and tick one of the boxes it runs the relevant report, the data range thing isn't an issue, i know that bit...

but i need to know how to know that if checkbox1 is selected it will run the report for that.



i am aware that i will need some fairly simple code to do this (I think) but just need a little help getting started please.

My textboxes are called:

text1, text2

my checkboxes arer called

check1,check2 etc

my preview button is called:

pre_but1

and my reports are called

rpt_1, rpt_2 etc..


please help

Reply With Quote
  #2  
Old February 16th, 2004, 06:12 PM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
You can place the following code on report open event and change it according to your need.

Private Sub Report_Open(Cancel As Integer)
Dim sql As String
Dim Criteria as string
Criteria = " WHERE Datefield Between [Forms]![Formname]![fromdate] And [Forms]![Formname]![todate]))"
sql = "SELECT * FROM Tablename "
If Forms![Formname]![chkusedatecriteria] Then
sql = sql & Criteria
End If
Me.RecordSource = sql
End Sub
__________________
V.Subramanian

Reply With Quote
  #3  
Old February 17th, 2004, 02:21 AM
chimp chimp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 147 chimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 33 m 17 sec
Reputation Power: 5
I have changed my checkboxes to an Option group now, and have successfully started to get this to work....

is there a way of having more than 20 options available, i have 23 lines of machines and i can only choose the 20 from the option group menu.

Reply With Quote
  #4  
Old February 17th, 2004, 02:36 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
use combo box instead of option button and put rowsource type property to "Value List" and rowsource to "value1;value2;value3 ...etc"
or set rowsource type property to "Table/Query" and use an SQL query for rowsource property.

Reply With Quote
  #5  
Old February 17th, 2004, 03:37 AM
chimp chimp is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 147 chimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 33 m 17 sec
Reputation Power: 5
Thanks,

little puzzled though......

i started to use this code when i was using the option group:

Select Case OptionGroupName
Case 1
DoCmd.OpenReport "MyReport1", acViewPreview
Case 2
DoCmd.OpenReport "MyReport2", acViewPreview
...
Case Else
MsgBox "No item selected."
End Select

how would i adapt this to suit my combo box, please

my combobox is called "Combo1"

cheers

Andy

Reply With Quote
  #6  
Old February 17th, 2004, 09:43 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
Select Case combo1
Case is = "value1"
DoCmd.OpenReport "MyReport1", acViewPreview
Case is = "value2"
DoCmd.OpenReport "MyReport2", acViewPreview
...
Case Else
MsgBox "No item selected."
End Select

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > checkbox help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT