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

Find function in Form Code Module
Docmd.Runsql Updating Select Max records by group
MS Access Can't Link to Encrypted Backend Database
Why is my LEFT JOIN an invalid operation (MS ACCESS 2003)
IIS7.5 MS Access Authentication
Getting a “Variable Not Defined” error when attempting to open a table in Access 2010
MS Access Report “per detail” formatting and accessing in VBA
Open form in access using criteria?
Temporarily change printer page size then revert back in Access 2007 using VBS
How to combine more than 2 Microsoft Access tables into one table?
Access mdb not giving correct result
MS Access Macro to change form to No data entry
setting control source property of a textbox of subform in its parent form in ms access?
I need to dynamically (and quickly) import part of the data in an Access table (a large one) into Excel
MS Access query does not append any rows as an append query, but does select rows as a select query
How can I stop my subform from autoscrolling when an item is being edited?

Categories

HOME
deployment
kde
google-play
tesseract
rsyslog
yarn
cross-browser
opengl-es-2.0
append
contact
python-unittest
windows-10-universal
facebook-php-sdk
php-7.1
spring-tool-suite
event-handling
footer
flux
web-sql
php-openssl
crystal-reports-2010
poltergeist
social-media
newline
librato
r-raster
binary-data
data-manipulation
jspresso
framemaker
protovis
language-concepts
picasso
adobe-premiere
twitch
xenforo
hue
document.write
user-controls
unixodbc
scorm
osx-mavericks
drupal-6
boost-preprocessor
knpmenubundle
sqlbulkcopy
linode
specrun
google-cdn
vmware-tools
radtreelist
ado.net-entity-data-model
trash
pcf
clang-static-analyzer
lua-5.1
superstack
design-by-contract
revolution-r
r-tree
execute
mutation-observers
sniffer
sonarqube5.1.2
apache-commons-net
tt-news
phalanger
project-planning
wp-query
poller
html5-notifications
industrial
multiprocessor
ril
rabl
pygit2
twrequest
onsubmit
dbproviderfactories
online-compilation
removeclass
bigcouch
hamachi
locationlistener
datareader
cxxtest
dmx512
mozilla-prism
thunderbird-lightning
xetex
spec#
scripting-languages
geneva-server
lzh

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