run time error 438 - MS Article Q146310 - custom sort

  • Thread starter newdatabaser via AccessMonster.com
  • Start date
N

newdatabaser via AccessMonster.com

I am trying to implement the custom sort feature defined by Microsoft Article
Q146310. I'm am using the northwind database. I receive a 438 error "Object
doesn't support this property or method" error. The debugger takes me to the
line below denoted by the "***". I've just begun my programming course so
I'm new to coding. I have tried implementing this on a different database
with the same results. Any ideas?
Also what is the " DESC" defined in this code?

Private Sub SetOrderBy_Click()
Dim strSQL As String, intCounter As Integer
' Build strSQL String.
For intCounter = 1 To 2
If Me("Sort" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Sort" & intCounter) & "]"
*** If Me("Check" & intCounter) = True Then
strSQL = strSQL & " DESC"
End If
strSQL = strSQL & ", "
End If
Next

If strSQL <> "" Then
' Strip Last Comma & Space.
strSQL = Left(strSQL, (Len(strSQL) - 2))
' Set the OrderBy property.
Reports![Sort Report].OrderBy = strSQL
Reports![Sort Report].OrderByOn = True
End If

End Sub
 
J

jmonty

I just tried it myself. It works.
You must not have named one of the checkboxes correctly.
Open the form in design mode and right click on each check box (Not the
label associated with the check box) - select properties. Go to the ALL tab
and verify the names are all Check1...Check5.

As for the DESC... in SQL (language) the DESC stands for Descending order.
By the same token if you use ASC, that would be Ascending order. However,
standard SQL assumes ASC in the ORDER BY clause when you do not specify ASC
or DESC.
That is why the code adds DESC only when necessary.

jmonty
 
N

newdatabaser via AccessMonster.com

That was it. I named the text boxes next to the check boxes with check1,
check2, etc. thank you!!!
I just tried it myself. It works.
You must not have named one of the checkboxes correctly.
Open the form in design mode and right click on each check box (Not the
label associated with the check box) - select properties. Go to the ALL tab
and verify the names are all Check1...Check5.

As for the DESC... in SQL (language) the DESC stands for Descending order.
By the same token if you use ASC, that would be Ascending order. However,
standard SQL assumes ASC in the ORDER BY clause when you do not specify ASC
or DESC.
That is why the code adds DESC only when necessary.

jmonty
I am trying to implement the custom sort feature defined by Microsoft Article
Q146310. I'm am using the northwind database. I receive a 438 error "Object
[quoted text clipped - 26 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top