Following on from my message below. I can confirm that the following piece
of code does work
DoCmd.OpenRe****t "Holiday Record Card", acViewPreview, , "Record = " &
Me.Record & " "
From this it does open up the correct record, but the second part still
doesn't work? I have just realised however that the Holiday Start Date
and
Holiday End Date are actually located on the subre****t (Holiday Card),
even
though the original data is recorded on the main contact table could this
be
the reason it can't find the search criteria? I assume it would need to
point it to the main form and the subre****t to collate the criteria needed
to
produce the re****t. I could quite easly place this on the main form,
however
i believe the reason for it being on the subre****t is that the dates
actually
relate to the holiday entitlement period and thererfore are best suited to
the subre****t to the actual main form.
Mike
"Mike" wrote:
> Hi CW,
>
> Thanks for your patience on this, hopefully I am getting there now.
>
> I entered the Event as you described and there was no highlighted areas
this
> time, however when i come to run the command it says I didn't specify
any
> search critera with a FindRecord action. I am assuming this has
something to
> do with the control on the form that you and Keith have mentioned.
>
> Just to clarify what i am doing and what i believe you are saying.
Record
> is the name of my primary key, which uses the autonumber function, and
is
> listed as one of the columns on the query(ie is part of the search
results)
> On the form, I have clicked on properties for the field that contains
the
> Record Autonumber and the control source is also Record is this right or
does
> the control come from somewhere else?
>
> "Cheese_whiz" wrote:
>
> > Hi Mike,
> >
> > Between is different than equal to.
> >
> > Try this:
> >
> > DoCmd.OpenRe****t "Holiday Record Card", acViewPreview, , "Record = " &
> > Me.Record & " And [Holiday Start] >= #" & Me.txtText145 & "# And
[Holiday
> > End] <= #" & Me.txtText147 & "#"
> >
> > Note: If Record is the name of a column in your query, you need to
match it
> > to the value of a control on your form. It SHOULD be something like,
as
> > Keith suggested:
> >
> > "Record = " & Me.ControlName & " And blah blah blah
> >
> > CW
> >
> > "Cheese_whiz" wrote:
> >
> > > Hi Mike,
> > >
> > > One thing you might need to do is use brackets around two word field
names.
> > > So something like:
> > > Holiday Start
> > >
> > > would become:
> > > [Holiday Start]
> > >
> > > See if that helps.
> > >
> > > I've looked back at my syntax and I think it's right assuming the
date
> > > fields in your query represent fields that are actually date type,
and not
> > > string. I'll see if I can get a minute a little later to test
things and
> > > verify.
> > >
> > > HTH,
> > > CW
> > >
> > > "Mike" wrote:
> > >
> > > > Hi keith,
> > > >
> > > > As CW broke this down, i entered the information as per
instructions. record
> > > > is the name of my column within the query and record is also on my
form and
> > > > the txtID (this field is also the primary key) are you saying this
isn't
> > > > right? As mentioned the first part of the code CW provided
worked, but it
> > > > was the second half that posed the problem as i am needing to
extract data
> > > > between two specific dates that are recorded on the form? I use a
dropdown
> > > > list by surname and firstname so that i can move between records
easily but
> > > > each record is assigned to a unique number ie the Record.
> > > >
> > > > I'll probably kick myself when i've managed to sort this, as i
think it's
> > > > just my misunderstanding.
> > > >
> > > > Mike
> > > >
> > > >
> > > >
> > > > "Keith Wilby" wrote:
> > > >
> > > > > "Mike" <Mike@[EMAIL PROTECTED]
> wrote in message
> > > > > news:FF765003-C540-4848-A122-7EF46CC4E1BC@[EMAIL PROTECTED]
> > > > > >
> > > > > > it highlighted in red, i then typed this in all one line as
you described,
> > > > > > but then it hightlighted the whole lot in red, am i missing
something
> > > > > > simple?
> > > > > > The following is exactly how i entered the code:
> > > > > >
> > > > > > DoCmd.OpenRe****t "Holiday Record Card", acViewPreview, ,
"Record = " &
> > > > > > Record &" And Holiday Start = #" & Me.txtText145 & "# And
Holiday End = #"
> > > > > > &
> > > > > > Me.txtText147 & "#"
> > > > > >
> > > > >
> > > > > PMFJI. What is the second "Record" in
> > > > >
> > > > > "Record = " & Record
> > > > >
> > > > > , a text box on your form? If so then try:
> > > > >
> > > > > "Record = " & Me.Record
> > > > >
> > > > > If the data type is Text then you'll need quotes:
> > > > >
> > > > > "Record = ' " & Me.Record & " ' "
> > > > >
> > > > > Keith.
> > > > > www.keithwilby.co.uk
> > > > >
> > > > >


|