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

User Defined Prompt = Ok

Status
Not open for further replies.
May 10, 2004
12
0
0
GB
Any Help Will be great.

Am using VB to Open,Refresh,Print,Save and Close several reports.

However the reports all have user defined prompts - 2 with date ranges and 4 with user names from a list.

When the macro gets to:

activedocuments.refresh

I get the user prompt form appear - How can I get the report to refresh without this appearing ?
(Not my reports so I can't remove the prompts!!)
 
Using the code I posted in the VBA forum, put it BEFORE the refresh statement - you will need a select case statement to determine what goes where eg

Code:
iVarCount = myDoc.Variables.Count
For j = 1 To iVarCount
   select case myDoc.Variables.Item(j).Name
      case "Select Username"
         myDoc.Variables.Item(j).Value = "Username Variable"
      case "Select Date"
         myDoc.Variables.Item(j).Value = "Date Variable"
      case else
   end select
Next j

'Refresh Report

The "Case" statements should reflect the exact text in the prompts (I have used 2 for illustration but you will need 1 for each discreet prompt)
The "Username Variable" and "Date Variable" should be variables which hold the correct usernames / dates to be entered into the prompts. Once the variables have been set, the document can refresh without the need to prompt

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
In case you want to skip the prompt and use the last entered prompt value all you need to use set the Application.Interactive to False..
Code:
Application.Interactive = False

Place that code before you do a refresh and then make sure you set the property back to True once the refresh is done... When done the prompt will not be prompted and they will use the last entered prompt value...

Sri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top