FindRecord Problem

D

David C. Holley

Help.

I'm trying to use the FindRecord method to create a search function to
find a record on a continuous form. However, I keep getting the error
message:

A macro set to one of the current field's properties failed because of
an error in a FindRecord action arguement.

DoCmd.FindRecord "1084", acAnywhere, False, acSearchAll, False, acAll

The code above attempts to find the record with the value 1084. In the
end, "1084" will be replaced with a reference to a form field.
 
S

Steven M. Britton

I think your problem has to do with the form you are using. Even though the
continous form might look like you can see everything you are only on one
record at a time. Try it in a datasheet or open the recordset in VBA and
search there.
 
S

Steven M. Britton

I played with it after I posted my last answer, should have done that
first...

DoCmd.FindRecord "1084", acAnywhere, False, acSearchAll, True, acAll

That should get you what you asked for.
 
D

David C. Holley

thx, but can you explain what I was missing.
I played with it after I posted my last answer, should have done that
first...

DoCmd.FindRecord "1084", acAnywhere, False, acSearchAll, True, acAll

That should get you what you asked for.

:
 
D

David C. Holley

I can get it to work with a literal value, however when I try to use a
variable, nothing happens.

I have confirmed that the ref to the field is correct, that
strSearchValue is being set correctly, and that the values that I'm
using for testing exist in the subform.

strSearchValue =
[Forms]![frmGuestItineraries].Form![subfrmTransportsSeachAndDisplay]![txtGotoRecord]
DoCmd.FindRecord strSearchValue, acAnywhere, False, acSearchAll,
True, acAll

David H
 
D

David C. Holley

Didn't get any bites on my last reply...
I can get it to work with a literal value, however when I try to use a
variable, nothing happens.

I have confirmed that the ref to the field is correct, that
strSearchValue is being set correctly, and that the values that I'm
using for testing exist in the subform.

strSearchValue =
[Forms]![frmGuestItineraries].Form![subfrmTransportsSeachAndDisplay]![txtGotoRecord]

DoCmd.FindRecord strSearchValue, acAnywhere, False, acSearchAll,
True, acAll

David H
I played with it after I posted my last answer, should have done that
first...
DoCmd.FindRecord "1084", acAnywhere, False, acSearchAll, True, acAll

That should get you what you asked for.

:
 
D

David C. Holley

I can get it to work with a literal value, however when I try to use a
variable, nothing happens.

I have confirmed that the ref to the field is correct, that
strSearchValue is being set correctly, and that the values that I'm
using for testing exist in the subform.

strSearchValue =

[Forms]![frmGuestItineraries].Form![subfrmTransportsSeachAndDisplay]![txtGotoRecord]


DoCmd.FindRecord strSearchValue, acAnywhere, False, acSearchAll,
True, acAll

David H
 
M

Marshall Barton

David said:
I can get it to work with a literal value, however when I try to use a
variable, nothing happens.

I have confirmed that the ref to the field is correct, that
strSearchValue is being set correctly, and that the values that I'm
using for testing exist in the subform.

strSearchValue =

[Forms]![frmGuestItineraries].Form![subfrmTransportsSeachAndDisplay]![txtGotoRecord]


DoCmd.FindRecord strSearchValue, acAnywhere, False, acSearchAll,
True, acAll


I don't use the FindRecord method, so I can't help you with
that. However I noticed that your subform control reference
is using the .Form property in the wrong place. Try this:

strSearchValue =
Me![subfrmTransportsSeachAndDisplay].Form![txtGotoRecord]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top