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.
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