Sabtu, 30 Juni 2012

[MS_AccessPros] Re: How to open a continuous form with a certain order using order by

 

Duane, If there are two replies this one has more info--my original post is not showing up. Sorry for not giving enough info. The correct records are showing but they are not ordered by City. (I entered City into the Ordr1 spot to simplify.) debug.Print is awesome--first time I've used it! It gives City. I'm not at work right now but I'm pretty sure that Me.OpenArgs when I hovered over it showed City too.

Thanks!
Connie

--- In MS_Access_Professionals@yahoogroups.com, "Duane" <duanehookom@...> wrote:
>
> Connie,
> You didn't tell us if this works or not. We assume not, but don't have a clue what you are getting for results.
>
> You also have a debug.Print (great!) but don't tell us the results.
>
> It seems you have asked enough questions here that you should be getting the hang of providing the significant information so someone can more easily provide some help.
>
> Duane Hookom
> MS Access MVP
>
> --- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@> wrote:
> >
> > Hi all!
> >
> > I've been working on opening another form with the records filtered and ordered based upon entries unbound boxes in the 1st form. The filtering is working beautifully thanks to John's help eons ago!
> >
> > Now I'm trying to have similar unbound boxes that will determine the order of the records. I've created comboboxes where column 0 (width = 0) has the same name as the field in the form.
> >
> > I've but the code for the ordering below. Also since I used OpenArgs I put what the code for that from the 2nd form (the one being opened).
> >
> > Thanks again!
> > Connie
> >
> > Code from first form "LookingEvents" where a button is clicked to open Search_AllListings from with filtered and ordered records:
> >
> > 'Create OrderBy string to be used in the OpenArgs and then in Form Open
> > If Nz(ordr1) <> 0 Then
> > strOrder = strOrder & [ordr1].Column(0) & ", "
> > End If
> > If Nz(Ordr2) <> 0 Then
> > strOrder = strOrder & [Ordr2].Column(0) & ", "
> > End If
> > If Nz(Ordr3) <> 0 Then
> > strOrder = strOrder & [Ordr3].Column(0) & ", "
> > End If
> >
> > 'See if the string has more than 2 characters (a trailng ", ") to remove message
> > lngLen2 = Len(strOrder) - 2
> > If lngLen2 <= 0 Then
> > MsgBox "No criteria have been entered"
> > Else 'Yep: there is something there, so remove the " AND " at the end.
> > strOrder = Left$(strOrder, lngLen2)
> > End If
> >
> > 'For debugging, remove the leading quote on the next line. Prints to Immediate Window (Ctrl+G).
> > 'Debug.Print strOrder
> > 'Open form with where and Order statement
> > DoCmd.OpenForm "Search_AllListings", , , strWhere, , , strOrder
> >
> > Code from Search_AllListings form:
> > Dim strOrder As String
> > If Not IsNull(OpenArgs) Then
> > Me.OrderBy = Me.OpenArgs
> > If Me.OrderByOnLoad = False Then
> > Me.OrderByOnLoad = True
> > End If
> > End If
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar