Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option buttons

Status
Not open for further replies.

cissilya

IS-IT--Management
Feb 15, 2005
42
US
Is there a way to connect an option button with a control source?
If so how, i have gone in to the option buttons properties but can not see the option for it.
Thank you
 
Yes you can.. it has a ControlSource Property.
Also use ChekBox instead!
Or tell us what exactly you are trying to do

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
i have two different transmittal forms and i need the user to choose one or the other, when they put in their request for the transmittal to print.
Figured if i put in a checkbox, saying unchecked print this or checked print this. but not really sure how to do it easily.
 
See the Northwind DB how they have done it to print reports.
It should be an option group.

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
for some reason i can not get it to pick up the report i want. not sure what i should do, i looked at the nordwind sample followed it but it would not pick it up.
in the control source i put in transmittal which is the name of the report but dont know if that is enough
 
See the code behind the form where you select the reports.
It is something like
Code:
Private Sub OptionGroupName_AfterUpdate()
Select Case OptionGroupName.Value
Case 1 
	'Print form1
Case 2 
	'Print form2
End Select
End Sub
for printing better to use report not form

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
this is what it looks like

Private Sub Print_Click()
On Error Resume Next
'DoCmd Minimize
DoCmd.Hourglass True

If Forms!Transmittal!Copies = 1 Then
DoCmd.OpenReport "transmittal"
End If
If Forms!Transmittal!Copies = 2 Then
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
End If
If Forms!Transmittal!Copies = 3 Then
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
End If
If Forms!Transmittal!Copies = 4 Then
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
DoCmd.OpenReport "transmittal"
End If

Rem If Me!Labels = 1 Then
Rem X = MsgBox("Please change paper in printer for labels", 1, "Print Labels for Transmittals")
Rem If X = 1 Then
Rem DoCmd.OpenReport "TransmittalLabels"
Rem End If
Rem End If



DoCmd.SetWarnings False
DoCmd.OpenQuery "TransmittalRecord"
DoCmd.SetWarnings True
DoCmd.Hourglass False


DoCmd.Close A_FORM, "transmittal"

End Sub
 
Do I missing something there? You said two transmittal forms and you are printing report. There is Docmd.PrintOut Method to set copies and page range etc.. do a search on help.
If you want to set the print count then you can have a combobox filled with 1-10 numbers and select from there and send the arguments to the report.

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
i might have explained it a little unclear, i have a form in wich you choose how many transmittals (residing in reports) to print. on this form i want to add a option/check button, so that when i have it checked or unchecked it will print one or the other of the transmittals.
I was not the one that created the db from the beginning, so i am trying to add to it and its turning out to be more complicated than it should be.
I appreciate all your help. Thank you
 
OK, I will come back to you tomorrow, sorry it is time to leave.
by the time you can try placing an optiongroup and try the same.
regards

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
An OptionGroup with 4 options, name it "ReportToPrint"
a command button "cmdPrint"

Code:
Sub PrintReports(PrintMode As Integer) 
     Select Case Me!ReportToPrint
        Case 1
            DoCmd.OpenReport "Report1", PrintMode            
        Case 2
            DoCmd.OpenReport "Report1", PrintMode
            DoCmd.OpenReport "Report2", PrintMode            
        Case 3
            DoCmd.OpenReport "Report1", PrintMode
            DoCmd.OpenReport "Report2", PrintMode
            DoCmd.OpenReport "Report3", PrintMode
        Case 4
            DoCmd.OpenReport "Report1", PrintMode
            DoCmd.OpenReport "Report2", PrintMode
            DoCmd.OpenReport "Report3", PrintMode
            DoCmd.OpenReport "Report4", PrintMode
    End Select 
End Sub
Select any of the choice and click cmdPrint

Code:
Private Sub cmdPrint_Click()
' Print selected report(s). This procedure uses the PrintReports
    PrintReports acNormal    
End Sub
This is as per my understading from your post. If this is not the case then please come back

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top