PC Review


Reply
Thread Tools Rate Thread

Docmd.FindRecord not working when filtered

 
 
Chaddy
Guest
Posts: n/a
 
      31st Oct 2008
I have a DB that users access pages via Allen Browne's search screen (Thank
god for this! I was having troubles getting a keyword search to work)
When users click on a result it comes up as filtered (record 1 of 1).
However on my form there is a text field that the user can click on to take
them to another record thats of a similar topic to the record they are
currently using.

The below works when all records are 'viewable' but not when the user has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2

Any help appreciated.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      31st Oct 2008
It makes sense that if the record you want is filtered out of the form, it
will not be found.

If you wish to remove the filter so the record can be found, add this line
above your code:
If Me.FilterOn Then Me.FilterOn = False

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chaddy" <(E-Mail Removed)> wrote in message
news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
>I have a DB that users access pages via Allen Browne's search screen (Thank
> god for this! I was having troubles getting a keyword search to work)
> When users click on a result it comes up as filtered (record 1 of 1).
> However on my form there is a text field that the user can click on to
> take
> them to another record thats of a similar topic to the record they are
> currently using.
>
> The below works when all records are 'viewable' but not when the user has
> selected the record from the search screen.
> DoCmd.GoToControl "Field1"
> DoCmd.FindRecord Field2
>
> Any help appreciated.


 
Reply With Quote
 
Chaddy
Guest
Posts: n/a
 
      31st Oct 2008
Thanks Allen,

I have tried that and it doesn't work as soon as the filter is removed the
form goes back to record 1 and it then doesn't know what was entered in
Feild2 on the record that was being viewed (some records don't have anything
in this field, others have the name of another record with a similar topic)

Does this make sense??? Sometimes I tend to confuse myself!!

"Allen Browne" wrote:

> It makes sense that if the record you want is filtered out of the form, it
> will not be found.
>
> If you wish to remove the filter so the record can be found, add this line
> above your code:
> If Me.FilterOn Then Me.FilterOn = False
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Chaddy" <(E-Mail Removed)> wrote in message
> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
> >I have a DB that users access pages via Allen Browne's search screen (Thank
> > god for this! I was having troubles getting a keyword search to work)
> > When users click on a result it comes up as filtered (record 1 of 1).
> > However on my form there is a text field that the user can click on to
> > take
> > them to another record thats of a similar topic to the record they are
> > currently using.
> >
> > The below works when all records are 'viewable' but not when the user has
> > selected the record from the search screen.
> > DoCmd.GoToControl "Field1"
> > DoCmd.FindRecord Field2
> >
> > Any help appreciated.

>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      31st Oct 2008
Not sure I understand what you are doing here.

Is Field2 *unbound*? If so, you are not entering a value to save, merely a
value to find.

Or is Field2 *bound* to a field? If so, entering something will save to that
field - proabaly not what you intend. Trying to use the one box to filter
and enter data is likely to lead to confusion.

Or are you using Filter By Form or some other mode?

Or are you trying to use Filter By Selection?

Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chaddy" <(E-Mail Removed)> wrote in message
news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
> Thanks Allen,
>
> I have tried that and it doesn't work as soon as the filter is removed the
> form goes back to record 1 and it then doesn't know what was entered in
> Feild2 on the record that was being viewed (some records don't have
> anything
> in this field, others have the name of another record with a similar
> topic)
>
> Does this make sense??? Sometimes I tend to confuse myself!!
>
> "Allen Browne" wrote:
>
>> It makes sense that if the record you want is filtered out of the form,
>> it
>> will not be found.
>>
>> If you wish to remove the filter so the record can be found, add this
>> line
>> above your code:
>> If Me.FilterOn Then Me.FilterOn = False
>>
>> "Chaddy" <(E-Mail Removed)> wrote in message
>> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
>> >I have a DB that users access pages via Allen Browne's search screen
>> >(Thank
>> > god for this! I was having troubles getting a keyword search to work)
>> > When users click on a result it comes up as filtered (record 1 of 1).
>> > However on my form there is a text field that the user can click on to
>> > take
>> > them to another record thats of a similar topic to the record they are
>> > currently using.
>> >
>> > The below works when all records are 'viewable' but not when the user
>> > has
>> > selected the record from the search screen.
>> > DoCmd.GoToControl "Field1"
>> > DoCmd.FindRecord Field2


 
Reply With Quote
 
Chaddy
Guest
Posts: n/a
 
      31st Oct 2008
Sorry Allen,
Thanks for your help, this is the last bug in my database!!

The database is being used as a procedure manual of sorts for electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant info
to the record being viewed) However, some pages may have the title to another
record (in the example above "Installing New Street Lights".

Therefore when viewing the Damaged Street Lights record and the user clicks
[LinkedInfo] the record changes now showing [Title] = Installing New Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in its
[LinkedInfo] field.

I may have set this up wrong so any suggestions would be appreciated.

"Allen Browne" wrote:

> Not sure I understand what you are doing here.
>
> Is Field2 *unbound*? If so, you are not entering a value to save, merely a
> value to find.
>
> Or is Field2 *bound* to a field? If so, entering something will save to that
> field - proabaly not what you intend. Trying to use the one box to filter
> and enter data is likely to lead to confusion.
>
> Or are you using Filter By Form or some other mode?
>
> Or are you trying to use Filter By Selection?
>
> Applying or removing a filter will have the effect of loading the form
> again, and hence moving to the first record.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Chaddy" <(E-Mail Removed)> wrote in message
> news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
> > Thanks Allen,
> >
> > I have tried that and it doesn't work as soon as the filter is removed the
> > form goes back to record 1 and it then doesn't know what was entered in
> > Feild2 on the record that was being viewed (some records don't have
> > anything
> > in this field, others have the name of another record with a similar
> > topic)
> >
> > Does this make sense??? Sometimes I tend to confuse myself!!
> >
> > "Allen Browne" wrote:
> >
> >> It makes sense that if the record you want is filtered out of the form,
> >> it
> >> will not be found.
> >>
> >> If you wish to remove the filter so the record can be found, add this
> >> line
> >> above your code:
> >> If Me.FilterOn Then Me.FilterOn = False
> >>
> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
> >> >I have a DB that users access pages via Allen Browne's search screen
> >> >(Thank
> >> > god for this! I was having troubles getting a keyword search to work)
> >> > When users click on a result it comes up as filtered (record 1 of 1).
> >> > However on my form there is a text field that the user can click on to
> >> > take
> >> > them to another record thats of a similar topic to the record they are
> >> > currently using.
> >> >
> >> > The below works when all records are 'viewable' but not when the user
> >> > has
> >> > selected the record from the search screen.
> >> > DoCmd.GoToControl "Field1"
> >> > DoCmd.FindRecord Field2

>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      31st Oct 2008
Use an unbound text box for the user to enter the value to find.

If you want to search 2 fields to find the value, you would build the filter
string like this:

If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If

That's assuming you need to use this as part of the utility you referred to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chaddy" <(E-Mail Removed)> wrote in message
news:5FA16ADD-4981-4425-8F13-(E-Mail Removed)...
> Sorry Allen,
> Thanks for your help, this is the last bug in my database!!
>
> The database is being used as a procedure manual of sorts for electricity
> faults. Users do not edit or load info (Only a Supervisor can add/edit
> info
> and this is done through another form).
> They search a topic, say Damaged Street lights.
> This appears on the form in Field 1 [Title] along with relevant info.
> One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
> On many records [LinkedInfo] may be empty (no other pages with relevant
> info
> to the record being viewed) However, some pages may have the title to
> another
> record (in the example above "Installing New Street Lights".
>
> Therefore when viewing the Damaged Street Lights record and the user
> clicks
> [LinkedInfo] the record changes now showing [Title] = Installing New
> Street
> Lights (as these two records are about the same topic). - Vice versa
> "Installing New Street Lights" has "Damaged Street Lights" appearing in
> its
> [LinkedInfo] field.
>
> I may have set this up wrong so any suggestions would be appreciated.
>
> "Allen Browne" wrote:
>
>> Not sure I understand what you are doing here.
>>
>> Is Field2 *unbound*? If so, you are not entering a value to save, merely
>> a
>> value to find.
>>
>> Or is Field2 *bound* to a field? If so, entering something will save to
>> that
>> field - proabaly not what you intend. Trying to use the one box to filter
>> and enter data is likely to lead to confusion.
>>
>> Or are you using Filter By Form or some other mode?
>>
>> Or are you trying to use Filter By Selection?
>>
>> Applying or removing a filter will have the effect of loading the form
>> again, and hence moving to the first record.
>>
>> --
>> Allen Browne - Microsoft MVP. Perth, Western Australia
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "Chaddy" <(E-Mail Removed)> wrote in message
>> news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
>> > Thanks Allen,
>> >
>> > I have tried that and it doesn't work as soon as the filter is removed
>> > the
>> > form goes back to record 1 and it then doesn't know what was entered in
>> > Feild2 on the record that was being viewed (some records don't have
>> > anything
>> > in this field, others have the name of another record with a similar
>> > topic)
>> >
>> > Does this make sense??? Sometimes I tend to confuse myself!!
>> >
>> > "Allen Browne" wrote:
>> >
>> >> It makes sense that if the record you want is filtered out of the
>> >> form,
>> >> it
>> >> will not be found.
>> >>
>> >> If you wish to remove the filter so the record can be found, add this
>> >> line
>> >> above your code:
>> >> If Me.FilterOn Then Me.FilterOn = False
>> >>
>> >> "Chaddy" <(E-Mail Removed)> wrote in message
>> >> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
>> >> >I have a DB that users access pages via Allen Browne's search screen
>> >> >(Thank
>> >> > god for this! I was having troubles getting a keyword search to
>> >> > work)
>> >> > When users click on a result it comes up as filtered (record 1 of
>> >> > 1).
>> >> > However on my form there is a text field that the user can click on
>> >> > to
>> >> > take
>> >> > them to another record thats of a similar topic to the record they
>> >> > are
>> >> > currently using.
>> >> >
>> >> > The below works when all records are 'viewable' but not when the
>> >> > user
>> >> > has
>> >> > selected the record from the search screen.
>> >> > DoCmd.GoToControl "Field1"
>> >> > DoCmd.FindRecord Field2

>>
>>


 
Reply With Quote
 
Tucker
Guest
Posts: n/a
 
      31st Oct 2008
Sorry Allen This wasn't quite what I was after/didn't work.
I think you're gonna regret trying to help me!! This email may be long but I
will try to explain the format of my DB.

Users do not enter any info except in your search screen (which works great
- THANKYOU!). This searches a keyword field.(record source is a query based
on Tbl_MainData.
The query for the Search screen only contains:
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
[View] has a default setting of "Click Here To View" and has a macro (from
On Click) that opens the form Frm_MainForm with the selected RecordID.

The Frm_MainForm then has a record source directly to Tbl_MainData. All
fields on this form are locked and can only be viewed by users. It contains
the fields
[RecordID], [Title], [DateLastUpdated], [Status], [Keywords], [Information],
[ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].

These are all bound fields (text boxes, dates etc. No Combos as the form is
for viewing only) back to the table Tbl_MainData

This form has no functions or calculations except a Cmd button to close and
another to bring up your search screen again so the user can search on
another topic. This all works perfectly (As stated before the recordset does
filter as 1 of 1).

The only other 'performance' this form needs to do is with the [LinkedInfo]
field.
Many records will have nothing in this field, others will have the title to
another record when it is of a similar topic. What I want it to do is when
clicked, change the record currently being viewed to the one that was in the
[LinkedInfo] field.

Adding/editing of records is done through another form
(Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
field is a Combo box ON THIS FORM linked to [Title], thereby making sure that
data entered matches info appearing in the Title field.

You may need a rest after reading that but hopefully that makes a little
more sense.. Can I do what I want to do????



"Allen Browne" wrote:

> Use an unbound text box for the user to enter the value to find.
>
> If you want to search 2 fields to find the value, you would build the filter
> string like this:
>
> If Not IsNull(Me.txtWot2Find) Then
> strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
> """) OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
> End If
>
> That's assuming you need to use this as part of the utility you referred to
> in your original post, which I think is:
> http://allenbrowne.com/ser-62.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Chaddy" <(E-Mail Removed)> wrote in message
> news:5FA16ADD-4981-4425-8F13-(E-Mail Removed)...
> > Sorry Allen,
> > Thanks for your help, this is the last bug in my database!!
> >
> > The database is being used as a procedure manual of sorts for electricity
> > faults. Users do not edit or load info (Only a Supervisor can add/edit
> > info
> > and this is done through another form).
> > They search a topic, say Damaged Street lights.
> > This appears on the form in Field 1 [Title] along with relevant info.
> > One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
> > On many records [LinkedInfo] may be empty (no other pages with relevant
> > info
> > to the record being viewed) However, some pages may have the title to
> > another
> > record (in the example above "Installing New Street Lights".
> >
> > Therefore when viewing the Damaged Street Lights record and the user
> > clicks
> > [LinkedInfo] the record changes now showing [Title] = Installing New
> > Street
> > Lights (as these two records are about the same topic). - Vice versa
> > "Installing New Street Lights" has "Damaged Street Lights" appearing in
> > its
> > [LinkedInfo] field.
> >
> > I may have set this up wrong so any suggestions would be appreciated.
> >
> > "Allen Browne" wrote:
> >
> >> Not sure I understand what you are doing here.
> >>
> >> Is Field2 *unbound*? If so, you are not entering a value to save, merely
> >> a
> >> value to find.
> >>
> >> Or is Field2 *bound* to a field? If so, entering something will save to
> >> that
> >> field - proabaly not what you intend. Trying to use the one box to filter
> >> and enter data is likely to lead to confusion.
> >>
> >> Or are you using Filter By Form or some other mode?
> >>
> >> Or are you trying to use Filter By Selection?
> >>
> >> Applying or removing a filter will have the effect of loading the form
> >> again, and hence moving to the first record.
> >>
> >> --
> >> Allen Browne - Microsoft MVP. Perth, Western Australia
> >> Tips for Access users - http://allenbrowne.com/tips.html
> >> Reply to group, rather than allenbrowne at mvps dot org.
> >>
> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
> >> > Thanks Allen,
> >> >
> >> > I have tried that and it doesn't work as soon as the filter is removed
> >> > the
> >> > form goes back to record 1 and it then doesn't know what was entered in
> >> > Feild2 on the record that was being viewed (some records don't have
> >> > anything
> >> > in this field, others have the name of another record with a similar
> >> > topic)
> >> >
> >> > Does this make sense??? Sometimes I tend to confuse myself!!
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> >> It makes sense that if the record you want is filtered out of the
> >> >> form,
> >> >> it
> >> >> will not be found.
> >> >>
> >> >> If you wish to remove the filter so the record can be found, add this
> >> >> line
> >> >> above your code:
> >> >> If Me.FilterOn Then Me.FilterOn = False
> >> >>
> >> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> >> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
> >> >> >I have a DB that users access pages via Allen Browne's search screen
> >> >> >(Thank
> >> >> > god for this! I was having troubles getting a keyword search to
> >> >> > work)
> >> >> > When users click on a result it comes up as filtered (record 1 of
> >> >> > 1).
> >> >> > However on my form there is a text field that the user can click on
> >> >> > to
> >> >> > take
> >> >> > them to another record thats of a similar topic to the record they
> >> >> > are
> >> >> > currently using.
> >> >> >
> >> >> > The below works when all records are 'viewable' but not when the
> >> >> > user
> >> >> > has
> >> >> > selected the record from the search screen.
> >> >> > DoCmd.GoToControl "Field1"
> >> >> > DoCmd.FindRecord Field2
> >>
> >>

>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      1st Nov 2008
So LinkedInfo is a Text field in Tbl_MainData, that contains a value that's
supposed to match the contents of the Title field in *one* other record?

Relationally, it would make more sense to me if LinkedInfo was a Number
field that stored the RecordID of the other record. (I'm assuming RecordID
is the primary key.) You can still *display* the Title from that record if
you wish. You would create a query with 2 copies of the same table, with the
numeric LinkedInfoID outer-joined to the RecordID of the other table, and so
you can get the Title of the other record into your form.

If that sounds like it would do the job, post back if you want help on how
to create the self-join (relationship for the table that looks itself up),
the outer join (so the query gives you all records, even if the LinkedInfoID
is null), or the code to find the other RecordID.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tucker" <(E-Mail Removed)> wrote in message
news:0931F080-DD31-44D4-99A5-(E-Mail Removed)...
> Sorry Allen This wasn't quite what I was after/didn't work.
> I think you're gonna regret trying to help me!! This email may be long but
> I
> will try to explain the format of my DB.
>
> Users do not enter any info except in your search screen (which works
> great
> - THANKYOU!). This searches a keyword field.(record source is a query
> based
> on Tbl_MainData.
> The query for the Search screen only contains:
> [RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
> [View] has a default setting of "Click Here To View" and has a macro (from
> On Click) that opens the form Frm_MainForm with the selected RecordID.
>
> The Frm_MainForm then has a record source directly to Tbl_MainData. All
> fields on this form are locked and can only be viewed by users. It
> contains
> the fields
> [RecordID], [Title], [DateLastUpdated], [Status], [Keywords],
> [Information],
> [ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].
>
> These are all bound fields (text boxes, dates etc. No Combos as the form
> is
> for viewing only) back to the table Tbl_MainData
>
> This form has no functions or calculations except a Cmd button to close
> and
> another to bring up your search screen again so the user can search on
> another topic. This all works perfectly (As stated before the recordset
> does
> filter as 1 of 1).
>
> The only other 'performance' this form needs to do is with the
> [LinkedInfo]
> field.
> Many records will have nothing in this field, others will have the title
> to
> another record when it is of a similar topic. What I want it to do is when
> clicked, change the record currently being viewed to the one that was in
> the
> [LinkedInfo] field.
>
> Adding/editing of records is done through another form
> (Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
> field is a Combo box ON THIS FORM linked to [Title], thereby making sure
> that
> data entered matches info appearing in the Title field.
>
> You may need a rest after reading that but hopefully that makes a little
> more sense.. Can I do what I want to do????
>
>
>
> "Allen Browne" wrote:
>
>> Use an unbound text box for the user to enter the value to find.
>>
>> If you want to search 2 fields to find the value, you would build the
>> filter
>> string like this:
>>
>> If Not IsNull(Me.txtWot2Find) Then
>> strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
>> """) OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
>> End If
>>
>> That's assuming you need to use this as part of the utility you referred
>> to
>> in your original post, which I think is:
>> http://allenbrowne.com/ser-62.html
>>
>> --
>> Allen Browne - Microsoft MVP. Perth, Western Australia
>> Tips for Access users - http://allenbrowne.com/tips.html
>> Reply to group, rather than allenbrowne at mvps dot org.
>>
>> "Chaddy" <(E-Mail Removed)> wrote in message
>> news:5FA16ADD-4981-4425-8F13-(E-Mail Removed)...
>> > Sorry Allen,
>> > Thanks for your help, this is the last bug in my database!!
>> >
>> > The database is being used as a procedure manual of sorts for
>> > electricity
>> > faults. Users do not edit or load info (Only a Supervisor can add/edit
>> > info
>> > and this is done through another form).
>> > They search a topic, say Damaged Street lights.
>> > This appears on the form in Field 1 [Title] along with relevant info.
>> > One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
>> > On many records [LinkedInfo] may be empty (no other pages with relevant
>> > info
>> > to the record being viewed) However, some pages may have the title to
>> > another
>> > record (in the example above "Installing New Street Lights".
>> >
>> > Therefore when viewing the Damaged Street Lights record and the user
>> > clicks
>> > [LinkedInfo] the record changes now showing [Title] = Installing New
>> > Street
>> > Lights (as these two records are about the same topic). - Vice versa
>> > "Installing New Street Lights" has "Damaged Street Lights" appearing in
>> > its
>> > [LinkedInfo] field.
>> >
>> > I may have set this up wrong so any suggestions would be appreciated.
>> >
>> > "Allen Browne" wrote:
>> >
>> >> Not sure I understand what you are doing here.
>> >>
>> >> Is Field2 *unbound*? If so, you are not entering a value to save,
>> >> merely
>> >> a
>> >> value to find.
>> >>
>> >> Or is Field2 *bound* to a field? If so, entering something will save
>> >> to
>> >> that
>> >> field - proabaly not what you intend. Trying to use the one box to
>> >> filter
>> >> and enter data is likely to lead to confusion.
>> >>
>> >> Or are you using Filter By Form or some other mode?
>> >>
>> >> Or are you trying to use Filter By Selection?
>> >>
>> >> Applying or removing a filter will have the effect of loading the form
>> >> again, and hence moving to the first record.
>> >>
>> >> --
>> >> Allen Browne - Microsoft MVP. Perth, Western Australia
>> >> Tips for Access users - http://allenbrowne.com/tips.html
>> >> Reply to group, rather than allenbrowne at mvps dot org.
>> >>
>> >> "Chaddy" <(E-Mail Removed)> wrote in message
>> >> news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
>> >> > Thanks Allen,
>> >> >
>> >> > I have tried that and it doesn't work as soon as the filter is
>> >> > removed
>> >> > the
>> >> > form goes back to record 1 and it then doesn't know what was entered
>> >> > in
>> >> > Feild2 on the record that was being viewed (some records don't have
>> >> > anything
>> >> > in this field, others have the name of another record with a similar
>> >> > topic)
>> >> >
>> >> > Does this make sense??? Sometimes I tend to confuse myself!!
>> >> >
>> >> > "Allen Browne" wrote:
>> >> >
>> >> >> It makes sense that if the record you want is filtered out of the
>> >> >> form,
>> >> >> it
>> >> >> will not be found.
>> >> >>
>> >> >> If you wish to remove the filter so the record can be found, add
>> >> >> this
>> >> >> line
>> >> >> above your code:
>> >> >> If Me.FilterOn Then Me.FilterOn = False
>> >> >>
>> >> >> "Chaddy" <(E-Mail Removed)> wrote in message
>> >> >> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
>> >> >> >I have a DB that users access pages via Allen Browne's search
>> >> >> >screen
>> >> >> >(Thank
>> >> >> > god for this! I was having troubles getting a keyword search to
>> >> >> > work)
>> >> >> > When users click on a result it comes up as filtered (record 1 of
>> >> >> > 1).
>> >> >> > However on my form there is a text field that the user can click
>> >> >> > on
>> >> >> > to
>> >> >> > take
>> >> >> > them to another record thats of a similar topic to the record
>> >> >> > they
>> >> >> > are
>> >> >> > currently using.
>> >> >> >
>> >> >> > The below works when all records are 'viewable' but not when the
>> >> >> > user
>> >> >> > has
>> >> >> > selected the record from the search screen.
>> >> >> > DoCmd.GoToControl "Field1"
>> >> >> > DoCmd.FindRecord Field2
>> >>
>> >>

>>
>>


 
Reply With Quote
 
Tucker
Guest
Posts: n/a
 
      2nd Nov 2008
Thanks Allen, That sounds great. If you can give me a hand with this I would
appreciate it. I originally tried it this way but couldn't get it to work.

As long as the end product is the user clicks on the field and the record
changes (even though the recordset has filtered to 1 of 1) I'll be a happy
man!!!

Chad.
(Tucker is when I log on from work, Chaddy from home).

"Allen Browne" wrote:

> So LinkedInfo is a Text field in Tbl_MainData, that contains a value that's
> supposed to match the contents of the Title field in *one* other record?
>
> Relationally, it would make more sense to me if LinkedInfo was a Number
> field that stored the RecordID of the other record. (I'm assuming RecordID
> is the primary key.) You can still *display* the Title from that record if
> you wish. You would create a query with 2 copies of the same table, with the
> numeric LinkedInfoID outer-joined to the RecordID of the other table, and so
> you can get the Title of the other record into your form.
>
> If that sounds like it would do the job, post back if you want help on how
> to create the self-join (relationship for the table that looks itself up),
> the outer join (so the query gives you all records, even if the LinkedInfoID
> is null), or the code to find the other RecordID.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Tucker" <(E-Mail Removed)> wrote in message
> news:0931F080-DD31-44D4-99A5-(E-Mail Removed)...
> > Sorry Allen This wasn't quite what I was after/didn't work.
> > I think you're gonna regret trying to help me!! This email may be long but
> > I
> > will try to explain the format of my DB.
> >
> > Users do not enter any info except in your search screen (which works
> > great
> > - THANKYOU!). This searches a keyword field.(record source is a query
> > based
> > on Tbl_MainData.
> > The query for the Search screen only contains:
> > [RecordID], [Title], [DateLastUpdated], [Status], [Keywords] and [View] .
> > [View] has a default setting of "Click Here To View" and has a macro (from
> > On Click) that opens the form Frm_MainForm with the selected RecordID.
> >
> > The Frm_MainForm then has a record source directly to Tbl_MainData. All
> > fields on this form are locked and can only be viewed by users. It
> > contains
> > the fields
> > [RecordID], [Title], [DateLastUpdated], [Status], [Keywords],
> > [Information],
> > [ContactPerson], [ContactPhoneNumber], [ApprovedBy] etc, and [LinkedInfo].
> >
> > These are all bound fields (text boxes, dates etc. No Combos as the form
> > is
> > for viewing only) back to the table Tbl_MainData
> >
> > This form has no functions or calculations except a Cmd button to close
> > and
> > another to bring up your search screen again so the user can search on
> > another topic. This all works perfectly (As stated before the recordset
> > does
> > filter as 1 of 1).
> >
> > The only other 'performance' this form needs to do is with the
> > [LinkedInfo]
> > field.
> > Many records will have nothing in this field, others will have the title
> > to
> > another record when it is of a similar topic. What I want it to do is when
> > clicked, change the record currently being viewed to the one that was in
> > the
> > [LinkedInfo] field.
> >
> > Adding/editing of records is done through another form
> > (Frm_MainScreenMaint)This has all the fields unlocked and the [LinkedInfo]
> > field is a Combo box ON THIS FORM linked to [Title], thereby making sure
> > that
> > data entered matches info appearing in the Title field.
> >
> > You may need a rest after reading that but hopefully that makes a little
> > more sense.. Can I do what I want to do????
> >
> >
> >
> > "Allen Browne" wrote:
> >
> >> Use an unbound text box for the user to enter the value to find.
> >>
> >> If you want to search 2 fields to find the value, you would build the
> >> filter
> >> string like this:
> >>
> >> If Not IsNull(Me.txtWot2Find) Then
> >> strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
> >> """) OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
> >> End If
> >>
> >> That's assuming you need to use this as part of the utility you referred
> >> to
> >> in your original post, which I think is:
> >> http://allenbrowne.com/ser-62.html
> >>
> >> --
> >> Allen Browne - Microsoft MVP. Perth, Western Australia
> >> Tips for Access users - http://allenbrowne.com/tips.html
> >> Reply to group, rather than allenbrowne at mvps dot org.
> >>
> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> news:5FA16ADD-4981-4425-8F13-(E-Mail Removed)...
> >> > Sorry Allen,
> >> > Thanks for your help, this is the last bug in my database!!
> >> >
> >> > The database is being used as a procedure manual of sorts for
> >> > electricity
> >> > faults. Users do not edit or load info (Only a Supervisor can add/edit
> >> > info
> >> > and this is done through another form).
> >> > They search a topic, say Damaged Street lights.
> >> > This appears on the form in Field 1 [Title] along with relevant info.
> >> > One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
> >> > On many records [LinkedInfo] may be empty (no other pages with relevant
> >> > info
> >> > to the record being viewed) However, some pages may have the title to
> >> > another
> >> > record (in the example above "Installing New Street Lights".
> >> >
> >> > Therefore when viewing the Damaged Street Lights record and the user
> >> > clicks
> >> > [LinkedInfo] the record changes now showing [Title] = Installing New
> >> > Street
> >> > Lights (as these two records are about the same topic). - Vice versa
> >> > "Installing New Street Lights" has "Damaged Street Lights" appearing in
> >> > its
> >> > [LinkedInfo] field.
> >> >
> >> > I may have set this up wrong so any suggestions would be appreciated.
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> >> Not sure I understand what you are doing here.
> >> >>
> >> >> Is Field2 *unbound*? If so, you are not entering a value to save,
> >> >> merely
> >> >> a
> >> >> value to find.
> >> >>
> >> >> Or is Field2 *bound* to a field? If so, entering something will save
> >> >> to
> >> >> that
> >> >> field - proabaly not what you intend. Trying to use the one box to
> >> >> filter
> >> >> and enter data is likely to lead to confusion.
> >> >>
> >> >> Or are you using Filter By Form or some other mode?
> >> >>
> >> >> Or are you trying to use Filter By Selection?
> >> >>
> >> >> Applying or removing a filter will have the effect of loading the form
> >> >> again, and hence moving to the first record.
> >> >>
> >> >> --
> >> >> Allen Browne - Microsoft MVP. Perth, Western Australia
> >> >> Tips for Access users - http://allenbrowne.com/tips.html
> >> >> Reply to group, rather than allenbrowne at mvps dot org.
> >> >>
> >> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> >> news:4901C195-27E6-417A-B83D-(E-Mail Removed)...
> >> >> > Thanks Allen,
> >> >> >
> >> >> > I have tried that and it doesn't work as soon as the filter is
> >> >> > removed
> >> >> > the
> >> >> > form goes back to record 1 and it then doesn't know what was entered
> >> >> > in
> >> >> > Feild2 on the record that was being viewed (some records don't have
> >> >> > anything
> >> >> > in this field, others have the name of another record with a similar
> >> >> > topic)
> >> >> >
> >> >> > Does this make sense??? Sometimes I tend to confuse myself!!
> >> >> >
> >> >> > "Allen Browne" wrote:
> >> >> >
> >> >> >> It makes sense that if the record you want is filtered out of the
> >> >> >> form,
> >> >> >> it
> >> >> >> will not be found.
> >> >> >>
> >> >> >> If you wish to remove the filter so the record can be found, add
> >> >> >> this
> >> >> >> line
> >> >> >> above your code:
> >> >> >> If Me.FilterOn Then Me.FilterOn = False
> >> >> >>
> >> >> >> "Chaddy" <(E-Mail Removed)> wrote in message
> >> >> >> news:4AC583D6-9B5C-4A20-B387-(E-Mail Removed)...
> >> >> >> >I have a DB that users access pages via Allen Browne's search
> >> >> >> >screen
> >> >> >> >(Thank
> >> >> >> > god for this! I was having troubles getting a keyword search to
> >> >> >> > work)
> >> >> >> > When users click on a result it comes up as filtered (record 1 of
> >> >> >> > 1).
> >> >> >> > However on my form there is a text field that the user can click
> >> >> >> > on
> >> >> >> > to
> >> >> >> > take
> >> >> >> > them to another record thats of a similar topic to the record
> >> >> >> > they
> >> >> >> > are
> >> >> >> > currently using.
> >> >> >> >
> >> >> >> > The below works when all records are 'viewable' but not when the
> >> >> >> > user
> >> >> >> > has
> >> >> >> > selected the record from the search screen.
> >> >> >> > DoCmd.GoToControl "Field1"
> >> >> >> > DoCmd.FindRecord Field2
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      2nd Nov 2008
Okay, obviously we can't do this for you, but once you have the
relationships in place, you can work on the form.

You will need to build the filter string for what you are searching form,
turn off the filter, FindFirst in the RecordsetClone of the form, and then
match the bookmarks.

Something like this:

Dim rs As DAO.Recordset
Dim strWhere As String
If IsNull(Me.LinkedIn) Then
Beep
Else
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then Me.FilterOn = False
strWhere = "[RecordID] = "& Me.LinkedIn
Set rs = Me.RecorsetClone
rs.FindFirst strWhere
If rs.NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tucker" <(E-Mail Removed)> wrote in message
news:655576E8-CEE6-42BA-8F12-(E-Mail Removed)...
> Thanks Allen, That sounds great. If you can give me a hand with this I
> would
> appreciate it. I originally tried it this way but couldn't get it to work.
>
> As long as the end product is the user clicks on the field and the record
> changes (even though the recordset has filtered to 1 of 1) I'll be a happy
> man!!!
>
> Chad.
> (Tucker is when I log on from work, Chaddy from home).


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
docmd.findrecord seeker Microsoft Access Form Coding 1 27th Jan 2010 02:48 PM
Using DoCmd.FindRecord Ben Lahoy Microsoft Access Forms 3 11th Mar 2008 05:43 PM
Using DoCmd.FindRecord Ben Lahoy Microsoft Access Form Coding 3 11th Mar 2008 05:43 PM
Access 2003, SQL, Docmd.findrecord "findrecord not available now" =?Utf-8?B?RWxhaW5l?= Microsoft Access Form Coding 5 31st Aug 2006 02:22 PM
DoCmd.FindRecord Mary Microsoft Access Form Coding 4 22nd Dec 2004 12:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 PM.