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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box values

Status
Not open for further replies.

Katana2003

Programmer
Jun 25, 2003
23
GB
I am currently writing a piece of code that will let the end users pick from a list of business documents to preview, however there are going to be a lot of documents so I was thinking of using a combo box and a button that accepts.

This is ware I have the problem I can't pick out the values of the combo box this is the code that I am currently trying any advice will be grateful.

This is a test script with only two documents in it hope this is enough for you.

'using the combo box print_format preview test print

Code:
If print_format = 1 Then
    DoCmd.OpenReport "test_print", acViewPreview
End If
'using the combo box print_format preview Std quote
Code:
If print_format = 2 Then
    DoCmd.OpenReport "std_quote", acViewPreview
End If



 
Make a text box that refers to the combo box. IE. the combo box is cboBox and the text box's Control Source is =[cboBox]. This should give you a value to use in your print code.
 
If I understand you correctly you simply want to display the report which the user selects.

First the bound column must me the report name or you'll have to use a ID field to lookup the report's name.

Let's say that the combo box's name is cboReportName.
Then your code might look like the following:

DoCmd.OpenReport Me.cboReportName, acViewPreview



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top