|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
|
#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 |
|
#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 |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > checkbox help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|