ms-access


MSAccess VBA ORDER BY not working on dynamic recordsource


The below code sets the recordsource on my form. The ORDER BY is not working since all the form properties are blank. How do I get sort?
Private Sub Form_Load()
If Me.OpenArgs <> "" Then
Me.AllowFilters = True
Me.FilterOn = True
Me.RecordSource = "QRY: BPRIL Data Entry By Order"
Me.Filter = Me.OpenArgs
Me.Requery
ElseIf (Me.RecordSource <> "BPRIL Data Entry") Then
Me.RecordSource = "BPRIL Data Entry"
Me.Requery
End If
Me.OrderBy = "[Item #]"
Me.OrderByOn = True
End Sub
If you are setting the recordsource, why not take the opportunity to sort?
Me.RecordSource = "SELECT Stuff FROM [BPRIL Data Entry] ORDER BY [Item #]"
You should consider doing yourself a favour and getting rid of spaces in table names and field names, it will make life a lot easier.

Related Links

runing a query of combinationfield in runtime,how?
Vim macro with ^M doesn't work
Infinitely looping through a recordset in VBA
Issue with the TOP 1 query
Calculating days between dates and parameters in MS Access
Alter MS Access Report output after its loaded
Is it possible to write this VBA code any better?
MS Access: Update a Linked List Box
How can I check if an instance of a Access 2010 form is still open?
How to debug a docmd.transferdatabase statement that does not work (no compiler error, simply does not xfer the data)
How to set initial selections of controls in a MS access report on its load?
Access 2000 Timeouts on bound recordset
Query to a Meaningful Report
MS Access “duplicate values” error, but I don't know why
Generate uml from vba
Is it possible to change Msysobjects in ms access

Categories

HOME
cloud
push-notification
plone
android-4.4-kitkat
yarn
v8
survey
alpha
azure-media-services
ios-charts
cross-validation
slick-slider
facebook-php-sdk
wheelnav.js
resize
alignment
usergrid
hex-editors
uitypeeditor
systemc
reactive-cocoa
evopdf
sms-gateway
samoa
grails3
jasonette
csrf-protection
cas
centos6.5
semantic-analysis
selectedindexchanged
maxmind
webkitspeechrecognition
libssl
flink-streaming
functor
gtrendsr
ghost4j
git-merge
bitbucket-pipelines
android-fingerprint-api
spring-security-kerberos
unixodbc
sencha-touch-2.3
galleria
skeleton-css-boilerplate
dds
knockout-components
dtexec
akka-cluster
arrow-keys
gcsfuse
color-profile
django-scheduler
mediaelement
jwplayer7
react-native-listview
sdhc
t4mvc
fouc
pundit
angular-leaflet-directive
muse
p2
key-management
skos
operator-precedence
knuth
google-style-guide
javafx-webengine
rdtsc
xcode-6.2
rdl
zend-route
openexr
doskey
transcoding
gnu-smalltalk
dir
listings
ocunit
specification-pattern
distutils
sublist
mt
frameset
dotnethighcharts
spring-portlet-mvc
asyncfileupload
hgsubversion
icanhaz.js
preference
kdbg
spec#
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
Mobile App
Mobile App
Mobile App