search form search button
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Search form with search button

Search form with search button

resolvedResolved · Urgent Priority · Version 2000

replyReplyTue 23 Feb 2010, 11:28Delegate Gary said...

Search form with search button

Good morning,

I am currently trying to design a search form from the DATA table that when information is typed into the necessary fields and the search button is clicked it displays all the results for that search.

The four fields that I need are:

Surname
Forename
Birth Date
Offence Date

I have tried queries and VBA (also SQL) and for some reason it doesn't work. Could you help with some code??

Could you send to me ASAP as I need to get this completed for a project that I am working on.

Thanks,

Gary

For upcoming training course dates see: Pricing & availability

replyReplyWed 24 Feb 2010, 09:59Trainer Stephen said...

RE: Search form with search button

Hi Gary

Thanks for the question

In general, you would first need to give your text boxes meaningful names.

Your code would then;

Declare string variables for Surname and Forename, and date variables for Offence Date and Birth Date.

You would then pass the values in the text boxes to the relevant variables. Note that all values in text boxes are text strings so you would have to use the cdate function to convert the date text box values into daye variables.

e.g.

dteOffDate = cdate(me.offdate.value)

finally you would create an SQL string with the variables embedded, this would look some thing like this;

"SELECT * FROM DATA WHERE Surname = & """ & strSurname & """ & " AND Forename" = & """ & strForename & """ & " AND Bdate"= "#" & dteBDate & "#" &" And OffenceDate" = " & "#" & dteOffDate & "#""

Finally, you would use thsi to open a DAO Recordset. This record set would then contain the data required

Hope this helps

Regards
Stephen

replyReplyWed 24 Feb 2010, 12:04Delegate Gary said...

RE: Search form with search button

Stephen,

Thanks alot. I actually managed to code this but I also found a way of using a query, macro and form to search the table and then I also include a Clear Form button with VBA attached.

This is another useful way. I have also been using the code that you taught me a couple of weeks ago to develop my Excel sheets and make them more dynamic.

Really enjoyed your course, it was very informative and built on the knowledge that I had acquired on the Access VBA course. Good job my friend and I hope you are well.

Thanks again,

Gary

 

 

Please browse our web site to find out more about
access courses and other Microsoft training courses.

Access tip:

Display current date & time in column of any width

The worksheet function =NOW() returns the current date & time. When entered into a column which is not wide enough to display the value NOW returns, the cell displays ###

View all Access hints and tips

forum postI have been asked to devise a chart - please see below, but I am having trouble putting it together. All I need is a graph showing % of calls answered live and date. Please see what I have done so far:

If you average the figures over 2 weeks it will ..

» Forum post: Chart Wizard


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training