Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Establishing Value of a Property in a Form

Status
Not open for further replies.

raygunc

Programmer
Dec 29, 2003
10
GB
Hi,

Apologies as I'm sure this is very basic but being new to this it is causing me complete neural breakdown!

I have a form (tabular) on which I want the user to select the sort order by clicking on the labels for each column.

I've used this code and this works well. No problems there:

[purple]Dim sortColumn As String

sortColumn = "[Name]"
Me.OrderBy = sortColumn
Me.OrderByOn = True
Me.Refresh[/purple]

I then wanted to take this a stage further and allow the first click to be sort ascending (default) the second click sort descending. I thought I could establish the current sort order by this method

[purple]currentSort = me!OrderBy[/purple]

Then if it's the same as the clicked sort order set OrderBy as:

[purple]me!OrderBy = sortColumn & " Desc"[/purple]

The problem is I keep getting an error message that Access can't find the field named OrderBy!

Where am I going wrong and how can I establsih the existing value of OrderBy

Thanks

Ray

 
Your syntax is wrong (me!OrderBy = sortColumn & " Desc") should be a dot not bang (me.OrderBy = sortColumn & " Desc")
 
Thank you.

Made the change and it works superbly.

Next stop the library - look up syntax!

Thanks again

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top