Disable Datasheet from Poping up after Query Execution

itsmedd

Registered User.
Local time
Today, 11:06
Joined
Sep 19, 2007
Messages
30
I am trying to take input for my reports based on a query result dynamically for which i dont want to display the Datasheet after the execution of Query ,inturn i am displaying results in Report. Any help on this would be appreciated.
 
Is your query an Append, Update, or Delete query? If it isn't, and it is just a Select query, then you don't need to run it before opening the report. You just need to open the report if it is based on that query.
 
Thanks for your inputs Bob,,
I am calling this report from a Form and i am generating this report based on the value chosen in Combo Box. So its a Dynamic Query which gets executed for every change event on this combo box & its a select query which is being used for the report... any help is greatly appreciated.. as i need to complete is module today... thanks in advance...
 
Which query pops up, the one for the combo box or the one for the report?
 
The 1 which contains the data for the report is popping up as Datasheet which i am displaying in the form of a report and i dont want this to popup.
 
What is the full code, or macro, are you using to open the report?
 
Bob,

Please find below the small piece of code and the screen shot of wat i am trying to do..

Combo Box Change Event code:

Private Sub CmbBXG_Change()
DoCmd.OpenQuery "Variance"
End Sub

View Report Command Button Click Event

Private Sub View_Report_Click()
On Error GoTo Err_View_Report_Click

Dim stDocName As String

stDocName = "Variance"
DoCmd.OpenReport stDocName, acPreview

Exit_View_Report_Click:
Exit Sub

Err_View_Report_Click:
MsgBox Err.Description
Resume Exit_View_Report_Click

End Sub
 

Attachments

  • combo.JPG
    combo.JPG
    15.3 KB · Views: 165
Bob,
Would appreciate your assistance on this...
 
This is what's causing your query to open:

Private Sub CmbBXG_Change()
DoCmd.OpenQuery "Variance"
End Sub

You shouldn't be opening the query, you should be setting the combo box's rowsource to the query and then using Me.CmbBXG.Requery to requery the combo box.
 
Bob,
Apologies for the extended trouble.. is there any example which i can see to understand how to do this... I am not sure if i set the rowsource to this query how will i populate the Combo Box Values and were should i be using "Me.CmbBXG.Requery to requery the combo box" and how.
 
Bob,
Apologies for the extended trouble.. is there any example which i can see to understand how to do this... I am not sure if i set the rowsource to this query how will i populate the Combo Box Values and were should i be using "Me.CmbBXG.Requery to requery the combo box" and how.

Can you post your database (after going to Tools > Database Tools > Compact and Repair) and then zipping it with WinZip, or something like it. After doing BOTH of those things the size has to be 393KB or less to post here.
 
Bob,
PFA a simulation on wat i am trying to do as my database size cannot be lowered to the size u specified...
Appreciate all your help on this Bob...
 

Attachments

Bob, would u need any more information on this to assist me.. Appreciate all your help on this...
 
Bob, would u need any more information on this to assist me.. Appreciate all your help on this...

Sorry - had other things come up. I downloaded your sample and it appeared to work properly for me, so I'm not exactly sure what's going on.
 
The code and other things had been working perfectly for me.. but my initial issue is the Data sheet window popping up after i select a name from the combo box which i dont want as i am displaying the same information in the form of a Report....I want to know the way to supress this window from popping up....
 
Open the form in design mode and, in the On Change event property, get rid of "rnqry."
 
Bob.. any suggestions for my issue. Please let me know if its possible in Access.
 
Thanks alot Bob... I am able to accomplish this task.Appreciate all your assistance on this.
 

Users who are viewing this thread

Back
Top Bottom