Find matching record based on partial string

B

bhammer

This question is not about displaying photos in a database, but about finding
a matching record using a partial string search or filter.

A photo database is setup to display side-by-side comparison photos. The
description field of the comparison photo contains a sentence or two plus the
filename of the original photo is matches, so it can be related to it. I want
to display the current and comparison photos on the Main form, with a list of
all photos in datasheet view on a Subform.

I have this working for the one, current, photo. I want to add the
comparison photo side-by-side.

The user scrolls down the datasheet on the subform listing all records. The
current record has a text field (txtFilename) that contains the string
"DSC0123.jpg", and somewhere in the txtDescription field is the number
portion only of the filename, like "0123". How can I find the other record in
the list that has the same text in part of the memo field (txtDescription).
Then how can I return the txtFilename of the matching record?

Brad
 
K

KARL DEWEY

I did not follow the fields and content. Can you post sample data with table
and field names with datatype?
 
B

bhammer

KARL DEWEY said:
I did not follow the fields and content. Can you post sample data with table
and field names with datatype?

My working form is rather complex, but I'll try to give you an idea:

I think the problem I want to solve boils down to the subform, based on
tblObservations containing:

ObservID AutoNum
PicFileName Text
Description Memo

Records:
1 "DCS0123.JPG" "(DCS0123.JPG) First visit Photo of blue sky."
2 "DCS0124.JPG" "(DCS0124.JPG) First visit Yellow flowers."
3 "DCS9876.JPG" "(DCS9876.JPG) Second visit Grey sky. 0123."
4 "DCS9875.JPG" "(DCS9875.JPG) Second visit Brown flowers. 0124."

The user selects the first record. Two photos get loaded in the main form--
DCS0123.JPG and DSC9876.JPG, because the second (record #3) Description
field contains the numbers, "0123".

The user selects the second record. Two photos loaded are--
DSC0124.JPG and DCS9875.JPG, because the "0124" string is found in the
Description field of record #4.

The user selects record #3 or #4 and no comparison photo is found or
displayed.

Get it? I want to return the record that has, in the Description field, the
string Like "0123" that comes from the last for characters before the "dot"
in the PicFileName field of the current record.
 
K

KARL DEWEY

Assuming that all PicFileName are the same format use this criteria on the
Description field --
Like "*" & Right(Left([PicFileName], 7, 4) & "*"
 
B

bhammer

KARL DEWEY said:
Assuming that all PicFileName are the same format use this criteria on the
Description field --
Like "*" & Right(Left([PicFileName], 7, 4) & "*"
Karl,
OK. I'm sorry, but which method? I want the OnCurrent event to be the
trigger.
 
C

Clif McIrvin

KARL DEWEY said:
Assuming that all PicFileName are the same format use this criteria on
the
Description field --
Like "*" & Right(Left([PicFileName], 7, 4) & "*"

I think Karl missed a closing paren:

Like "*" & Right(Left([PicFileName], 7), 4) & "*"
 
B

bhammer

Yes, I caught the missing paren, too.

I still cannot get the desired result, though. If I use FindFirst on a
RecordsetClone it moves my current record away from where it was on my
datasheet. I want it to remain there, while the Clone (in the background?)
finds the matching record but does Not move the current, visible, record on
the datasheet.

Is this even possible?
 

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