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' function required



 
 
Thread Tools Display Modes
  #1  
Old April 21st, 2008, 08:12 PM posted to microsoft.public.access.forms
Rohan McCarthy
external usenet poster
 
Posts: 1
Default 'Search' function required

I have developed a form, based on a query and set it to datasheet view mode.

What I'd like to do is use the form to search through records and then be
able to select a particular record by double-clicking within it, upon which
the clicked record will open in form view and the search form will close.

(I want to do this so I can deactivate my main form's 'Open in Edit Mode'
from the Switchboard, thereby preventing my users from scrolling through
forms that they don't really need to see and sometimes accidentally making
errors of input into fields of records that are already completed).

Can anyone help with this? I do know a small bit about coding (mostly from
this site!), but am far from an expert.

Rohan
  #2  
Old April 21st, 2008, 08:34 PM posted to microsoft.public.access.forms
Golfinray
external usenet poster
 
Posts: 1,597
Default 'Search' function required

You need a basic filter function. Whatever the field in the table is that you
would like to filter (search) on in your form, put a combo box on your form
and (using the combo wizard) select that field for your combo to look up. For
example, if you had 5 columns in your table and one of them was Customer ID,
you would want to search on that column. Then go into the combo's afterupdate
event (click on properties/events) and start the code builder (the little on
the end.) Type this is where the cursor is:
Me. Filter = "[thenameofthecolumnyouaresearching] = """ & Me.the#ofyourcombo
(like combo18) & """"
Me.Filteron = True

Now when the user scrolls through the combo and finds the record they want
that record will come up. You may need to do some tweaking, like getting the
form to close after they have edited that record. Do a search on here and you
should find that no problem.

"Rohan McCarthy" wrote:

I have developed a form, based on a query and set it to datasheet view mode.

What I'd like to do is use the form to search through records and then be
able to select a particular record by double-clicking within it, upon which
the clicked record will open in form view and the search form will close.

(I want to do this so I can deactivate my main form's 'Open in Edit Mode'
from the Switchboard, thereby preventing my users from scrolling through
forms that they don't really need to see and sometimes accidentally making
errors of input into fields of records that are already completed).

Can anyone help with this? I do know a small bit about coding (mostly from
this site!), but am far from an expert.

Rohan

  #3  
Old April 21st, 2008, 11:45 PM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default 'Search' function required

If you download my word merge example he

http://www.members.shaw.ca/AlbertKal.../msaccess.html

in the above the "super easy word merge" does have a sample search form that
does what you want.....

If you don't want to build a form, consider placing a search combo box on
the actual form (there is a wizard that will build this searching system for
you).

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



  #4  
Old April 22nd, 2008, 09:52 AM posted to microsoft.public.access.forms
Rohan McCarthy[_2_]
external usenet poster
 
Posts: 3
Default 'Search' function required

Thanks Golfinray.

I've done this, but it doesn't seem to be filtering the records as detailed.
You meant to add the combo-box to the main form, yes?

This is a cut-and-paste of the code:

'Lead Number' is the Autonumber field.

---
Private Sub Combo236_AfterUpdate()

Me.Filter = "[Lead Number] = """ & Me.Combo236 & """"
Me.FilterOn = False

End Sub
---

"Golfinray" wrote:

You need a basic filter function. Whatever the field in the table is that you
would like to filter (search) on in your form, put a combo box on your form
and (using the combo wizard) select that field for your combo to look up. For
example, if you had 5 columns in your table and one of them was Customer ID,
you would want to search on that column. Then go into the combo's afterupdate
event (click on properties/events) and start the code builder (the little on
the end.) Type this is where the cursor is:
Me. Filter = "[thenameofthecolumnyouaresearching] = """ & Me.the#ofyourcombo
(like combo18) & """"
Me.Filteron = True

Now when the user scrolls through the combo and finds the record they want
that record will come up. You may need to do some tweaking, like getting the
form to close after they have edited that record. Do a search on here and you
should find that no problem.

"Rohan McCarthy" wrote:

I have developed a form, based on a query and set it to datasheet view mode.

What I'd like to do is use the form to search through records and then be
able to select a particular record by double-clicking within it, upon which
the clicked record will open in form view and the search form will close.

(I want to do this so I can deactivate my main form's 'Open in Edit Mode'
from the Switchboard, thereby preventing my users from scrolling through
forms that they don't really need to see and sometimes accidentally making
errors of input into fields of records that are already completed).

Can anyone help with this? I do know a small bit about coding (mostly from
this site!), but am far from an expert.

Rohan

  #5  
Old April 22nd, 2008, 03:31 PM posted to microsoft.public.access.forms
Rohan McCarthy[_2_]
external usenet poster
 
Posts: 3
Default 'Search' function required

Thank you Albert!

It took a fair bit of fiddling around, but I adapted it to my needs in the
end.

Much appreciated.

Rohan

"Albert D. Kallal" wrote:

If you download my word merge example he

http://www.members.shaw.ca/AlbertKal.../msaccess.html

in the above the "super easy word merge" does have a sample search form that
does what you want.....

If you don't want to build a form, consider placing a search combo box on
the actual form (there is a wizard that will build this searching system for
you).

--
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 12:07 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.