ms-access


How to set initial selections of controls in a MS access report on its load?


I have a MS Access 2007 report which is based on a query that has some parameters that can be modified by selecting values in listboxes that are in the header of the report. The flow is as follows:
A user selects parameters in listboxes
A user clicks "generate" button. I have an OnClick event attached to it, which goes through all the listboxes, picks up their selections, puts together an SQL statement and sets it as source for the underlying MS Access query.
The only way I could find to properly refresh the report was to first do Me.Requery and then close and reopen the report. Just Me.Requery was not enough.
After the report is reopened, all the selections in the listboxes are lost. But I have them saved in a variable and I would be able to set them back, but I cannot find a suitable event.
I tried Report Load, Open, Current events - none of them worked. For Current event, I see that the selection gets set but then is deselected immediately. Could anybody suggest me what other event could I try or maybe a slight different approach all together?
Seems to me this one could be easier by giving the user a form with those list box controls, let her make her selections there, and then pass the selection criteria as the WhereCondition parameter to DoCmd.OpenReport.
From that page, the WhereCondition parameter is "A string expression that's a valid SQL WHERE clause without the word WHERE".

Related Links

how to create a menu bar in Access 2007 Form using VBA
Access not allowing users to delete rows
Printing pictures in Access Forms
printing a record
MS access mdb file has a “repair” status first time it is opened from Access 2007
Viewing ACCDB with Access 2010 runtime when Access 2007 is installed
is it possible to password protect ms-access 2007 file without encryption
Will an MS Access back-end for a client server application have transfer speed problems?
MS-Access, Bound Control on Form, Show user text, but record PK for that text
Access - Design change error message without attempting to make a change
VBA question: debug.print displays the correct data - how to get it out of Immediate window?
create a customised openFileDialog
access 2010 One form add information in table1 and table2
Trying to improve performance by removing DLookUp - Access 2007
MS ACCESS 2007 - Making a small pop form not full screen, when all other forms are full screen
How do I make a stored procedure in MS Access?

Categories

HOME
hive
wso2
push-notification
path-finding
json.net
octobercms
routes
programming-languages
amazon-ecs
jxls
survey
google-project-tango
datastax-java-driver
uber-api
gorm
user-input
volttron
nstableview
etl
decomposition
aurigma
emulator
abi
arabic
accessor
kudan
subdomains
nssegmentedcontrol
suricata
xcode-extension
retina-display
hue
webdriver-manager
temporary-files
broadcastreceiver
preconditions
gulp-sourcemaps
node-sass
babel-core
scrollable
react-scripts
prolog-setof
boost-multi-index
alphabet
nativeapplication
hittest
bind9
dwscript
vtigercrm
crosswalk-runtime
firmata
color-picker
adxstudio-portals
bstr
superstack
testng-dataprovider
lemon
wireshark-dissector
drawbitmap
remobjects
p2
geonetwork
dd
javafx-webengine
project-planning
funcunit
dir
ruby-datamapper
dbconnection
django-nonrel
cassini-dev
venn-diagram
netbeans-7.1
floating
site.master
google-friend-connect
gallio
mozilla-prism
fixed-width
ti-dsp
zune

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html