RE: Use Filter To Print This Record Only

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



GREAT! We Got It. Yes, I meant for you to change that since I was not sure
what the field name is. The quotes in Where clauses always mess me up, too.
As long as I have been programming, I still have to try a few times to get in
right.

"Bonnie" wrote:

> Thank you VERY much for the clarification. I did have to make one additional
> alteration to your filter line:
> Yours:
> Me.Filter = "MyField = '" & Forms![fSARMain]![fSAR].Form![Key] & "'"
> Mine:
> Me.Filter = "[Key] = '" & Forms![fSARMain]![fSAR].Form![Key] & "'"
>
> I had to change MyField to [Key]. It works now.
>
> Thanks for sticking with this thread. It's the quotes that mess me up.
> --
> Bonnie
>
>
> "Klatuu" wrote:
>
> > Sorry, Bonnie, did not mean to offend. I understand your frustration and I
> > am happy to try to help.
> > What you sent me is not correct, yet. Try looking in Acces Help for the
> > Filter Property. To correctly set a filter, it has to be Table Field Name =
> > Value To Filter On
> > Here is a cut and paste from Help:
> >
> > Me.Filter = "Country = 'USA'"
> > Me.FilterOn = True
> >
> > In the above case, Country is the name of the field in the table and USA is
> > the value to filter on.
> >
> > That is why it is not working is that there is no comparison value here.
> > Also note the compare vaule needs to be in single quotes.
> > I don't know what the table field name is, but for this lets call it MyField
> >
> > Your current code:
> > Me.Filter = Forms![fSARMain]![fSAR].Form![Key]
> > Me.FilterOn = True
> >
> > I am assuming that Forms![fSARMain]![fSAR].Form![Key] is the control on your
> > form that contains the value you want to filter on. If so, then change your
> > code to:
> > Me.Filter = "MyField = '" & Forms![fSARMain]![fSAR].Form![Key] & "'"
> > Me.FilterOn = True
> >
> > Again, I apologize for my comment. I did not mean for it to be as rude as
> > it looks.
> >
> > "Bonnie" wrote:
> >
> > > I was becoming confused and felt a bit of attitude in your replies. My
> > > purpose was to repost and try to communicate with someone else.
> > >
> > > Your final post to me in the prior thread read:
> > >
> > > One more time, the Me.Filter = has to have the name of the field in the
> > > record source to compare against. It also has to be formatted like a WHERE
> > > clause. That is what is basically is.
> > >
> > > I understand that. My line contained the name of the field. The field
> > > exists on a subform. It appears I have done what you said and it still gives
> > > me the same parameter problem.
> > >
> > > Please remember, I am not a skilled professional programmer. I am learning
> > > VB but much of it seems illogical until placed in a context I can relate to.
> > >
> > > If you care to continue, feel free but please come down to my level. Thank
> > > you for participating in the newsgroups and trying to help.
> > > --
> > > Bonnie
> > >
> > >
> > > "Klatuu" wrote:
> > >
> > > > Bonnie, I think I answered this post already in reports. Is it still not
> > > > working?
> > > >
> > > > "Bonnie" wrote:
> > > >
> > > > > Hi everyone, using A02 on XP. Not a programmer but trying to get there. I
> > > > > have a form (with a subform). On the subform a record is created, edited,
> > > > > macro validated and saved. Have a btn to preview report. Have the following
> > > > > in the OnOpen event of the report:
> > > > >
> > > > > Private Sub Report_Open(Cancel As Integer)
> > > > > Me.Filter = Forms![fSARMain]![fSAR].Form![Key]
> > > > > Me.FilterOn = True
> > > > > End Sub
> > > > >
> > > > > (I got the wordage: Forms![fSARMain]![fSAR].Form![Key] with the expression
> > > > > builder. [Key] is the unique ID field on the subform.)
> > > > >
> > > > > (fSAR is a subform)
> > > > >
> > > > > On the subform, the field on the record I want reads: 00022005
> > > > >
> > > > > With the form open to that record, I click the preview report btn and
> > > > > receive a
> > > > > dialog box titled "Enter Parameter Value" and where it would normally say
> > > > > what I want like "what key?", instead it reads "00022005". If I type 00022005
> > > > > into the parameter inquiry, the report opens with all records. Press enter on
> > > > > the blank and get the ol' fav ERROR in all fields. UGGGHHH! Can't figure out
> > > > > what I'm doing wrong!
> > > > >
> > > > > I would appreciate any help or advice. Thanks in advance!
> > > > > --
> > > > > Bonnie
.



Relevant Pages

  • Re: how can i filter my database?
    ... the user would NOT type the quotes, only the text to filter on ... ... Warm Regards, ... user types in 'villa' with quotes, I'd like the combo box to only display those records with 'villa' in the address line. ...
    (microsoft.public.access.modulesdaovba)
  • Re: ADODB & Recordset.Filter -> Problem mit Verkettung
    ... angeschaut und da steht: ... This error can occur if the filter syntax is incorrect. ... and grouping clauses with parentheses. ...
    (microsoft.public.de.vb.datenbank)
  • Re: Using OR in a search form
    ... I would like to filter where it looks for a only or a,b or b,c ... case, you have to wrap the value from the combo box in quotes, something ... If IsNull(WrapWith) Then WrapWith = Chr$ ... Give me all values where State is CO and where Communication is Yes. ...
    (microsoft.public.access.forms)
  • Re: how can i filter my database?
    ... the user would NOT type the quotes, only the text to filter on ... ... Access Basics ... Dave wrote: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Multiselect Listbox as qualifier for query
    ... Use a multi-select list box to filter a report ... > abbreviation exactly and never omit a comma. ... > You could then use INSTRto search the string. ... >>The parameter box displays but no matter how I enter the data (quotes; ...
    (microsoft.public.access.queries)