Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Multiple Search Field on Form

Status
Not open for further replies.

gbs01

MIS
Jun 2, 2003
73
US
I have the following code behind the DblClick on frmSearch:
--------------------------------------------------------
Private Sub SearchList_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset

DoCmd.OpenForm "frmMainCustomerWTabbed"

Set rst = Forms!frmMainCustomerWTabbed.Recordset.Clone

rst.FindFirst "[ACCT] = " & Me.SearchList
Forms!frmMainCustomerWTabbed.Bookmark = rst.Bookmark

DoCmd.Close acForm, Me.Name

Exit_SearchList_DblClick:
Exit Sub

Err_SearchList_DblClick:
MsgBox Err.Description
Resume Exit_SearchList_DblClick

End Sub
--------------------------------------------------
This code opens up the frmMainCustomerWTabbed fine, but will not display the record that I searched for in the frmSearch.

I have tried to change the BoundColumn of the frmSearch data, but no change. The frmMainCustomerWTabbed just opens & displays the first record in the table.

Here is the source of the frmSearch data:
-----------------------------------------
SELECT tblcust.acct, tblcust.name1, tblcust.add1, tblcust.phone1
FROM tblcust
WHERE (((tblcust.acct) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.name1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.add1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.phone1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*"));
------------------------------------------

ps: The acct field type is a decimal.

Thanks!
jlig
 
How are ya gbs01 . . . . .

it appears your problem is with [blue]Me.SearchList[/blue]. [purple]Post an example[/purple] of what it would like! I suspect multiple entries is this field . . . . .


Calvin.gif
See Ya! . . . . . .
 
I'm using this sample database called:
----------------------
search multiple fields.zip
----------------------


It allows a user to type in any piece of info about your customer & then open your main customer form with that record displayed.

I just cannot get my frmMainCustomerWTabbed to work with an ACCT lookup.
I tried the wizard, but it won't find the record. It does nothing.
I ran thru the wizard & used the Customer name1 field & it works fine!

What I want is a look-up on the top of my form that allows you to type in any known info on customer & have it display that customer.

name1 field = text
acct field = decimal

Thanks again!
jlig
 
gbs01 . . . . .
The [blue]search multiple fields[/blue] database is pretty straight forward.

Post the following properties for the listbox [blue]SearchList[/blue]:
[ol][li]Row Source[/li]
[li]Column Count[/li]
[li]Column Widths[/li][/ol]
Is [blue][ACCT][/blue] [purple]Text[/purple] or [purple]Numeric[/purple] data type?

Calvin.gif
See Ya! . . . . . .
 
Row Source
-----------
SELECT tblcust.acct, tblcust.name1, tblcust.add1, tblcust.phone1
FROM tblcust
WHERE (((tblcust.acct) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.name1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.add1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*")) OR (((tblcust.phone1) Like "*" & [Forms]![frmModelSearch]![txtSearch2] & "*"));
-------------
column count = 5
-------------
column widths = 0";0.9452";1.1813";1.1813"

Thanks!
 
Aceman, Thanks for looking over my code & jogging my memory. The problem is now fixed!

I originally had tblCust with ACCT as Decimal & Primary Key.
I went back to that table & added the field ID, as AutoNumber & made it the Primary Key.

It seems that the Look-Up wizard in my form lookup didn't like the ACCT. But now that it's just a regular field, it looks it up just fine!

I ran the wizard again, and chose ID, ACCT & NAME1. This time it asked to hide the ID key, so I knew it was going to work.

Anyways, now that the Look-up was working on the ACCT field, I went ahead & added the multiple search form. I keyed it on the ID field as well & it finds the Customer on the main form perfectly!

Thanks again,
jlig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top