UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> function to sort data    
 
   
killerwhale65
post Oct 4 2005, 09:59 AM
Post #1

UtterAccess Guru
Posts: 656



hi,

i am writing a function to sort data on a subform:
CODE
  
Public Function SortAZ()
'bepalen welke kolom focus heeft
Dim ctlCurrentControl As Control, strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
'MsgBox strControlName
'alfabetisch sorteren volgens control die focus heeft
Me.Parent!frmSpotten.Form.OrderBy = strControlName
Me.Parent!frmSpotten.Form.OrderByOn = True
End Function


i call =SortAZ() on the doubleclick event of the control. But i'm having troubles with the last 2 lines in the function.

Also, i would like to know how i can pass the variable formname (so the name of the subformcontrol on the mainform) through with the function to be able to use the same function on different subforms. (something like =SortAZ(formname) ?)

thanks!
Go to the top of the page
 
+
killerwhale65
post Oct 4 2005, 12:06 PM
Post #2

UtterAccess Guru
Posts: 656



i can get the formname via:

=SortAZ([formname])

and then:
Public Function SortAZ(formname as String)

but how should i call it then? I tried:
Forms!frmMain!formname.Form.OrderBy = strControlName & " DESC"

but that doesnt work. I guess its a matter of definition?
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 10:12 AM