A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search Form



 
 
Thread Tools Display Modes
  #1  
Old April 13th, 2007, 09:32 PM posted to microsoft.public.access.forms
Daniel
external usenet poster
 
Posts: 1,017
Default Search Form

Hi,

I want to create a form that allows a user to search a table.

Right now I have table tblCompanyInformation (name, address, etc..) and
tblProductData (information on their products). I also have a form called
frmCompanyInformation that shows certain information from both of these
tables.

My desire is this: For a user to open a form and be able to input a company
name and have that company's record appear from the frmCompanyInformation.

I hope this all makes sense

Thanks!
  #2  
Old April 13th, 2007, 09:51 PM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default Search Form

have you tried using the combo box wizard?

Try the above idea....when you type in, or select the company, the form will
move to that record.....


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada



  #3  
Old April 17th, 2007, 07:10 PM posted to microsoft.public.access.forms
Daniel
external usenet poster
 
Posts: 1,017
Default Search Form

I like the idea of the combo box, but I'm confused on how to actually tell
Access to move to the record of choice. I want an independant form that is
only for searching. When the user enters information (or looks up
information via combo box), they will need to hit a "search" button and that
button will locate the correct record and open it. What is the correct code
to make this button do that?


"Albert D. Kallal" wrote:

have you tried using the combo box wizard?

Try the above idea....when you type in, or select the company, the form will
move to that record.....


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada




  #4  
Old April 17th, 2007, 07:29 PM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default Search Form

"Daniel" wrote in message
news
I like the idea of the combo box, but I'm confused on how to actually tell
Access to move to the record of choice.



The combo box wizard will build in the code to "move" to the selected
reocrd.

Choose the 3rd option when building a combo box

eg:
Find a record based on the value I seleteced in my combo box

So, ms-access will "move" the form to the reocrd of choice...
Give the combo box wizard thing a try..it not too bad...

I want an independant form that is
only for searching.


Yes, I tend to like the above aprpoach, and I useally do make a seperate
seach form.

here is some screen shots of what I mean:

http://www.members.shaw.ca/AlbertKal...rch/index.html

There is also a seach form example he
http://www.datastrat.com/DataStrat2.html
and
http://www.mvps.org/access/forms/frm0045.htm

If you want to make your own, then:

Build a unbound form. Place a text box near the top. Lets call the control
txtLastName. Turn just about everything off for this form (record selector,
navigation buttons etc). This form is NOT attached to a table, nor any data
(we call this a un-bound form).

In addition to the above, you an build nice continues form that displays the
columns of data in a nice list. you can then put this form as a sub-form
into the above form.

Then, in the txtLastName after update event you simply stuff the results
into that sub-form.

dim strSql as string

strSql = "select * from tblCustomer where LastName like '" & me.txtLastName
& "*'"

me.MySubFormname.Form.RecordSource = strSql.

It is only a few lines of code at most....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.