OrderBy property

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!!
 
J

Jonathan Parminter

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
 
D

Dirk Goldgar

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]"
 
G

Guest

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)
 

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

Similar Threads


Top