Link to home
Start Free TrialLog in
Avatar of apcsolutionsuk
apcsolutionsukFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Microsoft Access Search Box

HI

Ive got a call loging database, I need a search box so it will show you when you type the company name in it will show all the calls that were logged from them.

also one for the date. so you can have all calls from this date to this date?
Avatar of Sean Strickland
Sean Strickland
Flag of United States of America image

One of the easiest methods I would suggest is to create a form (we'll assume the form's name is frmSearch) with a text box or combo box (we'll assume this is called txtCompany) that allows the user to type in or choose a company.  Place a button next to this text/combo box (we'll assume it's named cmdSearch), and place this code behind the on_click event of the command box:

Private Sub cmdSearch_click()
DoCmd.OpenForm "frmSearchCalls"
End Sub

Part two of this solution is to create a form that will display that data as you wish it to be shown and use a query that links to the company field on the form as its recordset.  In the query, place the following in the criteria for the Company Name field:
Forms!frmSearch!txtCompany

This will connect frmSearchCalls to frmSearch by way of the recordset query and will display all information for the company chosen or typed into txtCompany.
Avatar of apcsolutionsuk

ASKER

Thank you. got that working


just need the time now. ive tryed myself but i cant seam to get it working. please could you help me do the date task
You can use the same frmSearch form to add two text boxes.  One called "txtStartDate" for the first date and the other called "txtEndDate".

Create another command button (cmdSearchDates) and use the following code in the on_click:

Private Sub cmdSearch_click()
DoCmd.OpenForm "frmSearchDates"
End Sub

Now use the same second part of the above solution and create a form that will display the data you want and a query that will pull it to use as the recordsource of the form.  In the query, set the criteria for your date field to:
Between Forms!frmSearch!txtStartDate And Forms!frmSearch!txtEndDate

Same principles, different criteria.

Hope that helps,
Sean
Thanks that has answered my question :)


but if you could help me on a little thing.

When i click on the date field in the forms i would like it to show the little popus calander when clicked on.

and is there a command for the company box so it will find all the customers so you only have to type in the first few letters? thanks
ASKER CERTIFIED SOLUTION
Avatar of Sean Strickland
Sean Strickland
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi this is what i mean. it came up automaticly in the forms before
image.bmp
Ahh, I'm not sure about then, then.  I've primarily used Access '97.  I would suggest posting a separate question for that.  Sorry. :(

-Sean
thanks
You're welcome.

Thanks for the grade!