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

No max(x,y) function in Access
Why does a report throw an error when the corresponding query doesn't?
Programmatically Search an Access Listbox control's Items Based Off of a Textbox Entry
Auto populate a combobox
How can I add a button to an Access report to export it to Excel / PDF?
Access Caching ODBC connection settings
How to build the search form in ms-access
MS Access 2007 3044 Error
Assigning a Keyboard shortcut to a button in an Access 2007 form
ShellExecute() returns error code 5 when trying to open mdb file >10MB
Disable Check Box Based on Other Values
creating a server project in vb6 and ms-access
MS Access Dropdown List/Combo Box
How to communicate between two instances of open MDB with same form?
In Access 2007 CSV Export: Disable Scientific Notation
How do you format date fields of a Union Query in MS Access?

Categories

HOME
jdo
cookies
urbancode
c#-4.0
tizen
reserved
iterator
adb
packages
binary-tree
django-imagekit
basic
elasticsearch-hadoop
midi
resize
messages
dtrace
fortumo
circuit
percona
netflix
workload-scheduler
libtiff
google-static-maps
amazonsellercentral
mustache.php
php-openssl
crosstab
info.plist
entitlements
titanium-mobile
form-data
revolution-slider
hilbert-curve
az-application-insights
hue
opshub
azure-ml
avro4s
ibpy
password-encryption
mime
s
sas-jmp
cubic-spline
scrollable
appcompat
rails-routing
jlink
rdfs
directory-structure
passport-google-oauth
contact-list
sigabrt
ubuntu-10.04
hexdump
dataview
php-parse-error
asp.net5
kendonumerictextbox
lemon
icu4j
t4mvc
riak-cs
dundas
operator-precedence
codeigniter-routing
googlemock
terminfo
tld
funcunit
comexception
centos5
mysqltuner
soundtouch
coverflow
flash-builder4.5
ril
ora-00911
cos
gwt-rpc
html4
django-nonrel
seed
sqlperformance
jelly
clipper
spring-portlet-mvc
gnu-prolog
spyware
django-tagging
xdomainrequest
disclosure
actionview
suppress
icanhaz.js
ncqrs
javap

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
Mobile App
Mobile App
Mobile App