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

Run-time error '-2147221233(8004010f)': object not found - Access Database
Access: converting form result to table
One to many Combo Box
Search & Replace Null with Value from Select Query (Enter Parameter Value)
Access - Append query won't append a string input in a texbox form
How to structure a database to take input and assign applicable questions appropriately
MS Acces - Modify data in Form and save record
Carry forward counter in Access
Intermittent ODBC Connection Error in MS Access connecting to ZORTEC with ZODBC
Could not open table in Visual Basic 6.0, generated in PowerDesigner 6 AppModeler
Access validation rule violation update query across multiple tables
MS Access Table transformation
Runtime error in vb6:operation not allowed when object is closed
MS Access Row Source on table on the Front End disappears
Pivot combo box table in ms access
How to perform inexact matches on two data sets

Categories

HOME
yii2
listview
isabelle
plot
session
tesseract
leon
gps
icloud
fingerprint
azure-storage-tables
paradox
awesome-wm
elasticsearch-hadoop
session-variables
mapserver
commonmark
size
msp430
clearcase-ucm
workload-scheduler
http-status-code-504
excel-vba-mac
alpine
scichart
immutable.js
abi
microsoft-sync-framework
status
url-scheme
typo3-6.2.x
c++-amp
socialengine
junit5
winrt-xaml-toolkit
mozilla
jmonkeyengine
io-redirection
suricata
main
dartium
jquery-bootgrid
xcode-extension
reportbuilder
document.write
angularjs-factory
greenrobot-eventbus
jvm-languages
glew
eigenvalue
qcombobox
dotcover
jedis
prolog-setof
errordocument
python-c-api
logparser
domain-model
akka-cluster
cudafy.net
medium.com
firmata
fputcsv
testng-dataprovider
ipconfig
tform
rtbkit
srand
prerequisites
teamcity-8.0
python-3.2
comobject
coveralls
kcachegrind
event-bubbling
pretty-print
csquery
pick
qpainter
websocket4net
monomac
c18
.aspxauth
runtime.exec
opcache
shellexecute
angularjs-controller
custom-backend
mod-auth
xmemcached
invite
recent-documents
coda-slider
web-architecture
exchange-server-2003
ctp4
eqatec
multiple-languages
django-notification
lzh

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App