Re: Subform won't sort properly
From: Ken Snell [MVP] (kthsneisllis9_at_ncoomcastt.renaetl)
Date: 01/15/05
- Next message: Ken Snell [MVP]: "Re: Subform won't sort properly"
- Previous message: PharmTouch: "hide - unhide query"
- In reply to: Gina Whipp: "Subform won't sort properly"
- Next in thread: Ken Snell [MVP]: "Re: Subform won't sort properly"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 15 Jan 2005 17:34:37 -0500
Assuming that this is a copy/paste of your real code:
"Gina Whipp" <NotInterested@InViruses.com> wrote in message
news:Or1fxt0%23EHA.1936@TK2MSFTNGP10.phx.gbl...
> Hello All,
>
> Not sure why this won't work and I'm hoping someone can steer me in the
> right direction. The code located below is on the main form; at the
> bottom is the recordsource for the subform which won't open following the
> OrderBy. It opens sorting another field located on the form. Can someone
> explain why it won't follow my 'ORDER BY tblGroceryItems.giItem' on open
> of the main form. Thanks, in advance.
>
> Dim MySQL As String, MyCriteria As String, MyRecordSource As String
> Dim FieldValue As String, Tmp As Variant
>
> ' Initialize SELECT statement.
> MySQL = "SELECT * FROM tblGroceryItems WHERE "
> MyCriteria = "" & "ORDER BY tblGroceryItems.giItem"
> FieldValue = [txtlookfor]
>
> 'Create criteria for WHERE clause.
> If FieldValue <> "" Then
> MyCriteria = ("[giItem]" & " Like " & Chr(39) & Chr(42) &
> FieldValue & Chr(42) & Chr(39)) & "ORDER BY tblGroceryItems.giItem"
> Else
> MyCriteria = "True ORDER BY tblGroceryItems.giItem"
> End If
>
> ' Create SELECT statement.
> MyRecordSource = MySQL & MyCriteria
>
> ' Set RecordSource property of Form.
> Forms![frmMakeList].[sfrList].Form.RecordSource = MyRecordSource
> Forms![frmMakeList].[sfrList].SetFocus
>
>
> --
> Gina Whipp
>
- Next message: Ken Snell [MVP]: "Re: Subform won't sort properly"
- Previous message: PharmTouch: "hide - unhide query"
- In reply to: Gina Whipp: "Subform won't sort properly"
- Next in thread: Ken Snell [MVP]: "Re: Subform won't sort properly"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|