> Al thanks for all your help. New issue. The search is not working.
> Originally I had the button tied to a macro that would open the form that
[quoted text clipped - 46 lines]
>> hth
>> Al Camp
Al, thank you so much for the time you are takeing to helping me. Below is
the code I currently have:
Private Sub cmdSearchRPPSID_Click()
If IsNull(DLookup("[RPPSID]", "Tbl_CCA", "[RPPSID] = " & [Search])) Then
MsgBox "This RPPSID does not exist in the Table", vbOKOnly, "RPPSID
Not
Found"
Exit Sub
Else
DoCmd.OpenForm "frmCCA"
DoCmd.GoToControl "RPPSID"
DoCmd.FindRecord Forms!frmSearchDialog!Search
End If
End Sub
The error message box works. I get this error on the DoCmd.GoToControl
"RPPSID" line:
Error 2109 - There is no field named "RPPSID" in the current record
This is the field in my table that I am searching for the record. I was
reading about control sources yesterday, but was not successful in getting
this line to work.
The Macro I originally had tied to the button was OpenForm, the name of the
form is frmCCA, View Form, Where Condition -
[Tbl_CCA]![RPPSID]=[Forms]![frmSearch]![Search]
This found the correct record. If the RPPSID was not in the table the form
would open to a new blank record, I did not want that. I wanted to put
another button on the search form for creating a new record that would bring
up an empty for for data entry.
Again, thank you, Cindy
> Cindy,
> If your old macro did the Find correctly, then just convert that
[quoted text clipped - 70 lines]
> >> hth
> >> Al Camp
AlCamp - 29 Jan 2005 19:45 GMT
Cindy,
I would much rather have stuck with searching for AGY_ID... now, we're
doing RPPSID??
Please... let's try to stick to one problem at a time.
frmCCA should have text control on it named RPPSID. The ControlSource
for that is field RPPSID from the tbl_CCA.
Do you have that?
Al Camp
> Al, thank you so much for the time you are takeing to helping me. Below
> is
[quoted text clipped - 121 lines]
>> >> hth
>> >> Al Camp
AlCamp - 29 Jan 2005 20:15 GMT
Regarding my previous response... try this instead. It should work whether
you actually have [AGY_ID] on the form or not
You wrote...
> The Macro I originally had tied to the button was OpenForm, the name of
> the
> form is frmCCA, View Form, Where Condition -
> [Tbl_CCA]![RPPSID]=[Forms]![frmSearch]![Search]
OK... this is good info.... this is what you had in the old macro. Now
we just have to translate it to VB. I'll use the old AGY_ID code...
Private Sub cmdSearchAGYID_Click()
If IsNull(DLookup("[AGY_ID]", "Tbl_CCA", "[AGY_ID] = " & [Search])) Then
MsgBox "No such AGYID", vbOKOnly, "AGYID not found"
Exit Sub
Else
'------------- try this
DoCmd.OpenForm "frmACC", , , "[AGY_ID] = Forms!frmSearch!Search"
End If
End Sub
Al Camp
Cindy - 29 Jan 2005 20:33 GMT
That worked, thank you. I had a question about another db I am working on.
Can I use that same type of code to search for multiple records with the same
id. maybe a search by id and a date range that will bring up a list of all
occurences that meet that criteria then select the correct record to go to.
> Regarding my previous response... try this instead. It should work whether
> you actually have [AGY_ID] on the form or not
[quoted text clipped - 19 lines]
>
> Al Camp
AlCamp - 29 Jan 2005 22:23 GMT
If you're searching a field with that contains only "unique" values...
(probably indexed with no dupes) this code will find the exact record.
If you're searching a field that does not have "unique" values (contains
duplicate values) this code will find the First instance of that value.
A method I use for finding multiple answers to a recordset criteria is to
"filter" the dataset for that value. ONLY those records that meet the
criteria are returned, and they are contiguous, allowing for easy browsing
from one to another.
Check out Filter and Filteron functions in Help.
Al Camp
> That worked, thank you. I had a question about another db I am working
> on.
[quoted text clipped - 31 lines]
>>
>> Al Camp