OrderBy property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a command button on a form that I want to use to let the user select
to view records in alphabetic order. My code on the button is:

Me.OrderBy "Name"
Me.OrderByOn =True

I get a syntax error "improper use of property"

What am I doing wrong?
Thanks!!
 
Sam said:
-----Original Message-----
I have a command button on a form that I want to use to let the user select
to view records in alphabetic order. My code on the button is:

Me.OrderBy "Name"
Me.OrderByOn =True

I get a syntax error "improper use of property"

What am I doing wrong?
Thanks!!
Hi Sam,

name is a property of most objects. It is a good practice
to avoid have fields with the name of [name]. For example
[FirstName] and [LastName] or [FullName]. This can cause
an ambiguous reference.

Either change the name from [name] to avoid ongoing
hassles or try:
Me.OrderBy "[Name]"

the square brackets help access to associate name with a
field [name]

Luck
Jonathan
 
Jonathan Parminter said:
Sam said:
-----Original Message-----
I have a command button on a form that I want to use to let the user
select to view records in alphabetic order. My code on the button is:

Me.OrderBy "Name"
Me.OrderByOn =True

I get a syntax error "improper use of property"

What am I doing wrong?
Thanks!!
Hi Sam,

name is a property of most objects. It is a good practice
to avoid have fields with the name of [name]. For example
[FirstName] and [LastName] or [FullName]. This can cause
an ambiguous reference.

Either change the name from [name] to avoid ongoing
hassles or try:
Me.OrderBy "[Name]"

the square brackets help access to associate name with a
field [name]

Also, don't forget the equals sign:

Me.OrderBy = "[Name]"
 
Thanks, guys! That's kinda embarassing, but sometimes when you get bleary
eyed with this stuff, you don't see the obvious. I've learned you just have
to walk away at times.
Sam

Dirk Goldgar said:
Jonathan Parminter said:
Sam said:
-----Original Message-----
I have a command button on a form that I want to use to let the user
select to view records in alphabetic order. My code on the button is:

Me.OrderBy "Name"
Me.OrderByOn =True

I get a syntax error "improper use of property"

What am I doing wrong?
Thanks!!
Hi Sam,

name is a property of most objects. It is a good practice
to avoid have fields with the name of [name]. For example
[FirstName] and [LastName] or [FullName]. This can cause
an ambiguous reference.

Either change the name from [name] to avoid ongoing
hassles or try:
Me.OrderBy "[Name]"

the square brackets help access to associate name with a
field [name]

Also, don't forget the equals sign:

Me.OrderBy = "[Name]"

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top