Sorting my form?? (1 Viewer)

NewfieSarah

Registered User.
Local time
Today, 09:39
Joined
Feb 11, 2005
Messages
193
Hey all I have a problem I would like to populate my forms with the data from another form, and I know one way of how to do this however, I would like to be able to sort my form data. Since I have filtered my data I only see user 3's reccords not all users on the one form, I would like to have the ability to sort the form by the most current date. Since I already have more forms done, i would like to keep it that way. The fields I have on my form are:
PIN, PERMIT NUM, DATE, PHONE, PHONEWORK, OWNER, AGENT, CONTRACTOR, DECSCRIPTION, WIDTH, LENGTH, CLASS, DATE ISS, PENDING, HEIGHT, COST, NOTES. . . IN that order! So what I would like to do is put them in order by the date recored ie DATE. so that the most recent date shows up not Actually now just looking at it i think it is sorted by PERMIT NUM, so is there a way to sort by two different things? as well or what? Thanks in advance
 

RuralGuy

AWF VIP
Local time
Today, 06:09
Joined
Jul 2, 2005
Messages
13,826
Last edited:

NewfieSarah

Registered User.
Local time
Today, 09:39
Joined
Feb 11, 2005
Messages
193
Thanks for the shout out RG however what does this have to do with my sorting problem?? It is great that soemone finally told me about the reserved words, however this from was suppose to be for my help on sorting on my form. Thanks
 

NewfieSarah

Registered User.
Local time
Today, 09:39
Joined
Feb 11, 2005
Messages
193
Just another note maybe it is possible to sort my filtered data?? Any ideas on that? Since my form(Sub Forms) are filtered data, I would like to sort those fields. I have the data filtered, however I would like to it in order by date. Since it is just showing the data how it was added in the table, so there would bt 1978-1999-2001-1975-1999-2005 and I would like to to display asd 2005-2001-1999-1999-1978-1975 Thanks
 

Mile-O

Back once again...
Local time
Today, 13:09
Joined
Dec 10, 2002
Messages
11,316
Sarah, why don't you sort (and filter) the data in a query and bind that to your forum. It makes more sense to do this as having a table bound to a form doesn't give as much flexibility and can slow your database.
 

NewfieSarah

Registered User.
Local time
Today, 09:39
Joined
Feb 11, 2005
Messages
193
Well since I already have that part working I would rather not change it at this point, since I only have a bit more time on the project anways. However I didnt know that it could slow my database thanks for the info.
 

NewfieSarah

Registered User.
Local time
Today, 09:39
Joined
Feb 11, 2005
Messages
193
Hey all me again, just trying to figure out the answer to me problem I have been asking other people as well and I got this message the other day, maybe someone has some comments on it. Thanks
Code:
Public Sub subCopyToFormFromTable()
  Dim strOwner As String
  Dim strPhone As String
  Dim rst As DAO.Recordset
  Dim strSql As String
  'sort the arp table by date
  strSql = "select Owner, Phone from tblArp where whatever your criteria is orderby Date"
  rst = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
  rst.MoveLast
  strOwner = rst.Fields("Owner")
  strPhone = rst.Fields("Phone")
  rst.Close
  'assuming you have the form you need open
  Forms("frmName").Owner = strOwner
  Forms("frmName").phone = strPhone
End Sub
 

Laurentech

Registered User.
Local time
Today, 06:09
Joined
Nov 7, 2005
Messages
107
How about in the form's onopen event you put:

me.orderby="MyDate"
me.orderbyon=true

and RuralGuy is right, don't use 'Date' as the name of your date field.
 

Ripley

Registered User.
Local time
Today, 13:09
Joined
Aug 4, 2006
Messages
148
indeed, try an avoid SQL where ever possible, and use VB, simply because its less confusing:D
 

Users who are viewing this thread

Top Bottom