search area on a form that opens another form with search results

I have a main form that contains a Search txtbox that when cmdSearch is 
click, opens another form that contains a list box of items. what i want to 
do is sort this items by whatever letter is entered in the search txtbox and 
when clicking a selection from the list box, go to main form and fill in the 
areas with the selected item from the list box...can anyone help with this 
issue?
-- 
need help
0
Utf
3/15/2007 8:58:02 PM
access.forms 6864 articles. 2 followers. Follow

9 Replies
694 Views

Similar Articles

[PageSpeed] 50

Each form can refer to the contents of a control on the other form. On your 
popup form, pull the contents from the Search textbox to sort your list. 
These newsgroups have lots of examples of referring to controls on other 
forms.

For the second case, I would have the second form set a global 
(application-level) variable that the first form can then pick up 
immediately after the second form closes and use to locate the appropriate 
record. Create a module that contains the declaration of the variable as 
Public, then set the value in the Close event of the second form. Be sure to 
open the second form in Dialog mode, so the first form will pause until the 
second form closes.

Carl Rapson

"Will G" <bigwillno2@yahoo.com> wrote in message 
news:4D808FC3-7CEE-4516-AFF3-1E8A72EFC6F9@microsoft.com...
>I have a main form that contains a Search txtbox that when cmdSearch is
> click, opens another form that contains a list box of items. what i want 
> to
> do is sort this items by whatever letter is entered in the search txtbox 
> and
> when clicking a selection from the list box, go to main form and fill in 
> the
> areas with the selected item from the list box...can anyone help with this
> issue?
> -- 
> need help 


0
Carl
3/16/2007 3:47:23 PM
Hey Carl, 
i tried this code below for filtering but it seems to give an error, can you 
spot what's wrong with it....

Private Sub List0_DblClick(Cancel As Integer)

    Dim stfrmName As String
    Dim stLinkCriteria As String
    stfrmName = "MSM"
    stLinkCriteria = "[ModelNumber]=" & Me![List0]
    DoCmd.OpenForm stfrmName , , , stLinkCriteria
    DoCmd.close acForm, Me.Name, acSaveYes
End Sub

this is suppose to be the trigger even that when clicking an item from that 
list box
i should be able to populate the rest of the fields on the MSM form.....but 
it's giving me an error that says that OPENFORM action was canceled...what 
does that mean?
-- 
need help


"Will G" wrote:

> Hey Carl,
> i guess i am living on by ideas here man, it's there way for you to direct 
> me on how to do that, i am kinda new to this and i am just trying my best.  
> thanks
> -- 
> need help
> 
> 
> "Carl Rapson" wrote:
> 
> > Each form can refer to the contents of a control on the other form. On your 
> > popup form, pull the contents from the Search textbox to sort your list. 
> > These newsgroups have lots of examples of referring to controls on other 
> > forms.
> > 
> > For the second case, I would have the second form set a global 
> > (application-level) variable that the first form can then pick up 
> > immediately after the second form closes and use to locate the appropriate 
> > record. Create a module that contains the declaration of the variable as 
> > Public, then set the value in the Close event of the second form. Be sure to 
> > open the second form in Dialog mode, so the first form will pause until the 
> > second form closes.
> > 
> > Carl Rapson
> > 
> > "Will G" <bigwillno2@yahoo.com> wrote in message 
> > news:4D808FC3-7CEE-4516-AFF3-1E8A72EFC6F9@microsoft.com...
> > >I have a main form that contains a Search txtbox that when cmdSearch is
> > > click, opens another form that contains a list box of items. what i want 
> > > to
> > > do is sort this items by whatever letter is entered in the search txtbox 
> > > and
> > > when clicking a selection from the list box, go to main form and fill in 
> > > the
> > > areas with the selected item from the list box...can anyone help with this
> > > issue?
> > > -- 
> > > need help 
> > 
> > 
> > 
0
Utf
3/16/2007 5:37:08 PM
Hard to tell, but is the value in the listbox a string? If so, you need to 
put quotes around the value in stLinkCriteria:

    stLinkCriteria = "[ModelNumber]='" & Me![List0] & "'"

Also, is [ModelNumber] included in your form's RecordSource? It will have to 
be in order to filter this way.

Beyond that, I can't see anything.

Carl Rapson

"Will G" <bigwillno2@yahoo.com> wrote in message 
news:3B2E9715-9844-460B-A21C-272A9B8D1054@microsoft.com...
> Hey Carl,
> i tried this code below for filtering but it seems to give an error, can 
> you
> spot what's wrong with it....
>
> Private Sub List0_DblClick(Cancel As Integer)
>
>    Dim stfrmName As String
>    Dim stLinkCriteria As String
>    stfrmName = "MSM"
>    stLinkCriteria = "[ModelNumber]=" & Me![List0]
>    DoCmd.OpenForm stfrmName , , , stLinkCriteria
>    DoCmd.close acForm, Me.Name, acSaveYes
> End Sub
>
> this is suppose to be the trigger even that when clicking an item from 
> that
> list box
> i should be able to populate the rest of the fields on the MSM 
> form.....but
> it's giving me an error that says that OPENFORM action was canceled...what
> does that mean?
> -- 
> need help
>
>
> "Will G" wrote:
>
>> Hey Carl,
>> i guess i am living on by ideas here man, it's there way for you to 
>> direct
>> me on how to do that, i am kinda new to this and i am just trying my 
>> best.
>> thanks
>> -- 
>> need help
>>
>>
>> "Carl Rapson" wrote:
>>
>> > Each form can refer to the contents of a control on the other form. On 
>> > your
>> > popup form, pull the contents from the Search textbox to sort your 
>> > list.
>> > These newsgroups have lots of examples of referring to controls on 
>> > other
>> > forms.
>> >
>> > For the second case, I would have the second form set a global
>> > (application-level) variable that the first form can then pick up
>> > immediately after the second form closes and use to locate the 
>> > appropriate
>> > record. Create a module that contains the declaration of the variable 
>> > as
>> > Public, then set the value in the Close event of the second form. Be 
>> > sure to
>> > open the second form in Dialog mode, so the first form will pause until 
>> > the
>> > second form closes.
>> >
>> > Carl Rapson
>> >
>> > "Will G" <bigwillno2@yahoo.com> wrote in message
>> > news:4D808FC3-7CEE-4516-AFF3-1E8A72EFC6F9@microsoft.com...
>> > >I have a main form that contains a Search txtbox that when cmdSearch 
>> > >is
>> > > click, opens another form that contains a list box of items. what i 
>> > > want
>> > > to
>> > > do is sort this items by whatever letter is entered in the search 
>> > > txtbox
>> > > and
>> > > when clicking a selection from the list box, go to main form and fill 
>> > > in
>> > > the
>> > > areas with the selected item from the list box...can anyone help with 
>> > > this
>> > > issue?
>> > > -- 
>> > > need help
>> >
>> >
>> > 


0
Carl
3/19/2007 5:48:58 PM
Hey Carl,
thanks for your help, i guess it does work, only that, i got a little 
comfuse with what i am doing and i would love for you to clarify it for me....

i have the main form "MSM"...this form contains a search text field and i 
want to enter text here, a string, and when click the search button, i want 
to openup a different for that's named "frmSelectMSM" ...this form contains a 
list box with ModelNumber(string and could be for example A99000M), should be 
same field as the one entered in the search area txtbox.......this list box 
is the only item on this form....i want to filter this list if the user 
enters "A" or if the user enters the entire ModelNumber. And when i select 
one of this filtered ModelNumber, i like to populate the fields on the main 
form "MSM", that contains ModelNumber, and other fields. .....if you 
understand this, can you help me with it?
-- 
need help


"Carl Rapson" wrote:

> Hard to tell, but is the value in the listbox a string? If so, you need to 
> put quotes around the value in stLinkCriteria:
> 
>     stLinkCriteria = "[ModelNumber]='" & Me![List0] & "'"
> 
> Also, is [ModelNumber] included in your form's RecordSource? It will have to 
> be in order to filter this way.
> 
> Beyond that, I can't see anything.
> 
> Carl Rapson
> 
> "Will G" <bigwillno2@yahoo.com> wrote in message 
> news:3B2E9715-9844-460B-A21C-272A9B8D1054@microsoft.com...
> > Hey Carl,
> > i tried this code below for filtering but it seems to give an error, can 
> > you
> > spot what's wrong with it....
> >
> > Private Sub List0_DblClick(Cancel As Integer)
> >
> >    Dim stfrmName As String
> >    Dim stLinkCriteria As String
> >    stfrmName = "MSM"
> >    stLinkCriteria = "[ModelNumber]=" & Me![List0]
> >    DoCmd.OpenForm stfrmName , , , stLinkCriteria
> >    DoCmd.close acForm, Me.Name, acSaveYes
> > End Sub
> >
> > this is suppose to be the trigger even that when clicking an item from 
> > that
> > list box
> > i should be able to populate the rest of the fields on the MSM 
> > form.....but
> > it's giving me an error that says that OPENFORM action was canceled...what
> > does that mean?
> > -- 
> > need help
> >
> >
> > "Will G" wrote:
> >
> >> Hey Carl,
> >> i guess i am living on by ideas here man, it's there way for you to 
> >> direct
> >> me on how to do that, i am kinda new to this and i am just trying my 
> >> best.
> >> thanks
> >> -- 
> >> need help
> >>
> >>
> >> "Carl Rapson" wrote:
> >>
> >> > Each form can refer to the contents of a control on the other form. On 
> >> > your
> >> > popup form, pull the contents from the Search textbox to sort your 
> >> > list.
> >> > These newsgroups have lots of examples of referring to controls on 
> >> > other
> >> > forms.
> >> >
> >> > For the second case, I would have the second form set a global
> >> > (application-level) variable that the first form can then pick up
> >> > immediately after the second form closes and use to locate the 
> >> > appropriate
> >> > record. Create a module that contains the declaration of the variable 
> >> > as
> >> > Public, then set the value in the Close event of the second form. Be 
> >> > sure to
> >> > open the second form in Dialog mode, so the first form will pause until 
> >> > the
> >> > second form closes.
> >> >
> >> > Carl Rapson
> >> >
> >> > "Will G" <bigwillno2@yahoo.com> wrote in message
> >> > news:4D808FC3-7CEE-4516-AFF3-1E8A72EFC6F9@microsoft.com...
> >> > >I have a main form that contains a Search txtbox that when cmdSearch 
> >> > >is
> >> > > click, opens another form that contains a list box of items. what i 
> >> > > want
> >> > > to
> >> > > do is sort this items by whatever letter is entered in the search 
> >> > > txtbox
> >> > > and
> >> > > when clicking a selection from the list box, go to main form and fill 
> >> > > in
> >> > > the
> >> > > areas with the selected item from the list box...can anyone help with 
> >> > > this
> >> > > issue?
> >> > > -- 
> >> > > need help
> >> >
> >> >
> >> > 
> 
> 
> 
0
Utf
3/19/2007 7:38:18 PM
"Will G" <bigwillno2@yahoo.com> wrote in message 
news:E14F7B8A-5346-4357-B1EF-121F88C97901@microsoft.com...
> Hey Carl,
> thanks for your help, i guess it does work, only that, i got a little
> comfuse with what i am doing and i would love for you to clarify it for 
> me....
>
> i have the main form "MSM"...this form contains a search text field and i
> want to enter text here, a string, and when click the search button, i 
> want
> to openup a different for that's named "frmSelectMSM" ...this form 
> contains a
> list box with ModelNumber(string and could be for example A99000M), should 
> be
> same field as the one entered in the search area txtbox.......this list 
> box
> is the only item on this form....i want to filter this list if the user
> enters "A" or if the user enters the entire ModelNumber. And when i select
> one of this filtered ModelNumber, i like to populate the fields on the 
> main
> form "MSM", that contains ModelNumber, and other fields. .....if you
> understand this, can you help me with it?
> -- 
> need help
>
>
<snipped>

Let's try this again. There are two steps to this process: passing the value 
from your search text field to the second form so that the listbox can be 
filtered, and returning the listbox selection to the first form so it can be 
used to "populate the fields" (more on this later).

For the first step, pass the value from the search text box to the second 
form in the OpenArgs parameter of the FormOpen method:

DoCmd.OpenForm "frmSelectMSM",,,,,acDialog,txtSearchBox

Be sure to use your own text box control name here. We open the second form 
in Dialog mode so that the first form "pauses" until the second form closes. 
In the Load event of the second form, "pick up" the value from the OpenArgs 
parameter and use it to filter your listbox. I can't really give an example 
here, because I don't know how you are populating the listbox with the model 
number strings. If the listbox is bound to a table, you can just modify the 
RowSource of the listbox to incorporate the value passed in OpenArgs:

lstListBox.RowSource = "SELECT ... FROM ... WHERE [ModelNumber] LIKE '" & 
OpenArgs & "*'"

I made up the name of the listbox control here, so be sure to use your 
actual control name. If you are populating the listbox by some other method, 
you'll need to adjust it as needed to incorporate the value in OpenArgs.

For the second step (returning the listbox selection back to the first 
form), you need to first create a module to define an application-level 
("global") variable that can be used from both forms. Create a new module 
(or you can use an existing module if you have one) and add the variable 
declaration:

Public gblSelection As String

In the second form, in the DblClick event of the listbox (or whatever other 
method you use to exit the form), store the listbox selection in the global 
variable:

gblSelection = lstListBox

(be sure to use your own variable and control names here). Back in the MSM 
form, immediately following the OpenForm call that opened the second form, 
pick up the value from the global variable and use it to "filter" the MSM 
form:

Me.RecordSource = "SELECT ... FROM ... WHERE [ModelNumber]='" & gblSelection 
& "'"

This assumes you're using an SQL statement for the form's RecordSource 
(which is what I prefer, for just this reason). If you're using a table or 
query, you may want to use the form's Filter and FilterOn properties instead 
(like in your previous question). If your MSM form is unbound, you can fetch 
the record from the table yourself (with a Recordset) and populate the 
controls on the form.

I don't know if there's more I can add to this without actually writing the 
code for you. Study these examples, look in Access and VB Help, and search 
these newsgroups for specifics. What you're trying to do is fairly common 
and has been addressed many times in these newsgroups.

Good luck,

Carl Rapson


0
Carl
3/19/2007 8:10:45 PM
Hey Carl thanks for the help man, but i guess i am just gonna try something 
else because it's not working. the click event of the search fields it's 
opening the other form but that's all it's doing. and again it might not be 
something that i am not seeing since i have very little experience doing 
this.  what did is this.....
Main for: 
on clik
  DoCmd.OpenForm "frmSelectMSM", , , , , acDialog, TxtSearch
  Me.RecordSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE 
[ModelNumber]='" & gblSelection & "'"

frmSelectMSM:

Private Sub SearchListBox_DblClick(Cancel As Integer)
    gblSelection = SearchListBox
End Sub

Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
 SearchListBox.RowSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE 
[ModelNumber] LIKE '" & OpenArgs & "*'"
End Sub

GLOBALMODULE:
Option Compare Database
Public gblSelection As String

frmSelectMSM:
recordsource: tblMSM

ListBox:
no control source
row source.....SELECT [MSM].[MSMID], [MSM].[ModelNumber] FROM [MSM];
-- 
need help


"Carl Rapson" wrote:

> "Will G" <bigwillno2@yahoo.com> wrote in message 
> news:E14F7B8A-5346-4357-B1EF-121F88C97901@microsoft.com...
> > Hey Carl,
> > thanks for your help, i guess it does work, only that, i got a little
> > comfuse with what i am doing and i would love for you to clarify it for 
> > me....
> >
> > i have the main form "MSM"...this form contains a search text field and i
> > want to enter text here, a string, and when click the search button, i 
> > want
> > to openup a different for that's named "frmSelectMSM" ...this form 
> > contains a
> > list box with ModelNumber(string and could be for example A99000M), should 
> > be
> > same field as the one entered in the search area txtbox.......this list 
> > box
> > is the only item on this form....i want to filter this list if the user
> > enters "A" or if the user enters the entire ModelNumber. And when i select
> > one of this filtered ModelNumber, i like to populate the fields on the 
> > main
> > form "MSM", that contains ModelNumber, and other fields. .....if you
> > understand this, can you help me with it?
> > -- 
> > need help
> >
> >
> <snipped>
> 
> Let's try this again. There are two steps to this process: passing the value 
> from your search text field to the second form so that the listbox can be 
> filtered, and returning the listbox selection to the first form so it can be 
> used to "populate the fields" (more on this later).
> 
> For the first step, pass the value from the search text box to the second 
> form in the OpenArgs parameter of the FormOpen method:
> 
> DoCmd.OpenForm "frmSelectMSM",,,,,acDialog,txtSearchBox
> 
> Be sure to use your own text box control name here. We open the second form 
> in Dialog mode so that the first form "pauses" until the second form closes. 
> In the Load event of the second form, "pick up" the value from the OpenArgs 
> parameter and use it to filter your listbox. I can't really give an example 
> here, because I don't know how you are populating the listbox with the model 
> number strings. If the listbox is bound to a table, you can just modify the 
> RowSource of the listbox to incorporate the value passed in OpenArgs:
> 
> lstListBox.RowSource = "SELECT ... FROM ... WHERE [ModelNumber] LIKE '" & 
> OpenArgs & "*'"
> 
> I made up the name of the listbox control here, so be sure to use your 
> actual control name. If you are populating the listbox by some other method, 
> you'll need to adjust it as needed to incorporate the value in OpenArgs.
> 
> For the second step (returning the listbox selection back to the first 
> form), you need to first create a module to define an application-level 
> ("global") variable that can be used from both forms. Create a new module 
> (or you can use an existing module if you have one) and add the variable 
> declaration:
> 
> Public gblSelection As String
> 
> In the second form, in the DblClick event of the listbox (or whatever other 
> method you use to exit the form), store the listbox selection in the global 
> variable:
> 
> gblSelection = lstListBox
> 
> (be sure to use your own variable and control names here). Back in the MSM 
> form, immediately following the OpenForm call that opened the second form, 
> pick up the value from the global variable and use it to "filter" the MSM 
> form:
> 
> Me.RecordSource = "SELECT ... FROM ... WHERE [ModelNumber]='" & gblSelection 
> & "'"
> 
> This assumes you're using an SQL statement for the form's RecordSource 
> (which is what I prefer, for just this reason). If you're using a table or 
> query, you may want to use the form's Filter and FilterOn properties instead 
> (like in your previous question). If your MSM form is unbound, you can fetch 
> the record from the table yourself (with a Recordset) and populate the 
> controls on the form.
> 
> I don't know if there's more I can add to this without actually writing the 
> code for you. Study these examples, look in Access and VB Help, and search 
> these newsgroups for specifics. What you're trying to do is fairly common 
> and has been addressed many times in these newsgroups.
> 
> Good luck,
> 
> Carl Rapson
> 
> 
> 
0
Utf
3/19/2007 10:37:08 PM
In frmSelectMSM, you need to set SearchListBox.RowSource in the Form_Load 
event, not the Form_Filter event.

Carl Rapson

"Will G" <bigwillno2@yahoo.com> wrote in message 
news:76181599-EB00-4908-8C8E-658AC435D18A@microsoft.com...
> Hey Carl thanks for the help man, but i guess i am just gonna try 
> something
> else because it's not working. the click event of the search fields it's
> opening the other form but that's all it's doing. and again it might not 
> be
> something that i am not seeing since i have very little experience doing
> this.  what did is this.....
> Main for:
> on clik
>  DoCmd.OpenForm "frmSelectMSM", , , , , acDialog, TxtSearch
>  Me.RecordSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
> [ModelNumber]='" & gblSelection & "'"
>
> frmSelectMSM:
>
> Private Sub SearchListBox_DblClick(Cancel As Integer)
>    gblSelection = SearchListBox
> End Sub
>
> Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
> SearchListBox.RowSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
> [ModelNumber] LIKE '" & OpenArgs & "*'"
> End Sub
>
> GLOBALMODULE:
> Option Compare Database
> Public gblSelection As String
>
> frmSelectMSM:
> recordsource: tblMSM
>
> ListBox:
> no control source
> row source.....SELECT [MSM].[MSMID], [MSM].[ModelNumber] FROM [MSM];
> -- 
> need help
>
>
> "Carl Rapson" wrote:
>
>> "Will G" <bigwillno2@yahoo.com> wrote in message
>> news:E14F7B8A-5346-4357-B1EF-121F88C97901@microsoft.com...
>> > Hey Carl,
>> > thanks for your help, i guess it does work, only that, i got a little
>> > comfuse with what i am doing and i would love for you to clarify it for
>> > me....
>> >
>> > i have the main form "MSM"...this form contains a search text field and 
>> > i
>> > want to enter text here, a string, and when click the search button, i
>> > want
>> > to openup a different for that's named "frmSelectMSM" ...this form
>> > contains a
>> > list box with ModelNumber(string and could be for example A99000M), 
>> > should
>> > be
>> > same field as the one entered in the search area txtbox.......this list
>> > box
>> > is the only item on this form....i want to filter this list if the user
>> > enters "A" or if the user enters the entire ModelNumber. And when i 
>> > select
>> > one of this filtered ModelNumber, i like to populate the fields on the
>> > main
>> > form "MSM", that contains ModelNumber, and other fields. .....if you
>> > understand this, can you help me with it?
>> > -- 
>> > need help
>> >
>> >
>> <snipped>
>>
>> Let's try this again. There are two steps to this process: passing the 
>> value
>> from your search text field to the second form so that the listbox can be
>> filtered, and returning the listbox selection to the first form so it can 
>> be
>> used to "populate the fields" (more on this later).
>>
>> For the first step, pass the value from the search text box to the second
>> form in the OpenArgs parameter of the FormOpen method:
>>
>> DoCmd.OpenForm "frmSelectMSM",,,,,acDialog,txtSearchBox
>>
>> Be sure to use your own text box control name here. We open the second 
>> form
>> in Dialog mode so that the first form "pauses" until the second form 
>> closes.
>> In the Load event of the second form, "pick up" the value from the 
>> OpenArgs
>> parameter and use it to filter your listbox. I can't really give an 
>> example
>> here, because I don't know how you are populating the listbox with the 
>> model
>> number strings. If the listbox is bound to a table, you can just modify 
>> the
>> RowSource of the listbox to incorporate the value passed in OpenArgs:
>>
>> lstListBox.RowSource = "SELECT ... FROM ... WHERE [ModelNumber] LIKE '" &
>> OpenArgs & "*'"
>>
>> I made up the name of the listbox control here, so be sure to use your
>> actual control name. If you are populating the listbox by some other 
>> method,
>> you'll need to adjust it as needed to incorporate the value in OpenArgs.
>>
>> For the second step (returning the listbox selection back to the first
>> form), you need to first create a module to define an application-level
>> ("global") variable that can be used from both forms. Create a new module
>> (or you can use an existing module if you have one) and add the variable
>> declaration:
>>
>> Public gblSelection As String
>>
>> In the second form, in the DblClick event of the listbox (or whatever 
>> other
>> method you use to exit the form), store the listbox selection in the 
>> global
>> variable:
>>
>> gblSelection = lstListBox
>>
>> (be sure to use your own variable and control names here). Back in the 
>> MSM
>> form, immediately following the OpenForm call that opened the second 
>> form,
>> pick up the value from the global variable and use it to "filter" the MSM
>> form:
>>
>> Me.RecordSource = "SELECT ... FROM ... WHERE [ModelNumber]='" & 
>> gblSelection
>> & "'"
>>
>> This assumes you're using an SQL statement for the form's RecordSource
>> (which is what I prefer, for just this reason). If you're using a table 
>> or
>> query, you may want to use the form's Filter and FilterOn properties 
>> instead
>> (like in your previous question). If your MSM form is unbound, you can 
>> fetch
>> the record from the table yourself (with a Recordset) and populate the
>> controls on the form.
>>
>> I don't know if there's more I can add to this without actually writing 
>> the
>> code for you. Study these examples, look in Access and VB Help, and 
>> search
>> these newsgroups for specifics. What you're trying to do is fairly common
>> and has been addressed many times in these newsgroups.
>>
>> Good luck,
>>
>> Carl Rapson
>>
>>
>> 


0
Carl
3/20/2007 3:15:27 PM
Hey Carl
again thanks for your help and for being patient with me....i did what you 
told me, got the searchListBox.Rowsource at the load even of the 
frmSelectMSM, but it doesnt work, all it does is open the form and this time, 
the list shows no record. i have it set up just as stated in the previous 
post and with the change that you just suggested and still dont load with 
ModelNumbers sorted. any further suggestion?
-- 
need help


"Carl Rapson" wrote:

> In frmSelectMSM, you need to set SearchListBox.RowSource in the Form_Load 
> event, not the Form_Filter event.
> 
> Carl Rapson
> 
> "Will G" <bigwillno2@yahoo.com> wrote in message 
> news:76181599-EB00-4908-8C8E-658AC435D18A@microsoft.com...
> > Hey Carl thanks for the help man, but i guess i am just gonna try 
> > something
> > else because it's not working. the click event of the search fields it's
> > opening the other form but that's all it's doing. and again it might not 
> > be
> > something that i am not seeing since i have very little experience doing
> > this.  what did is this.....
> > Main for:
> > on clik
> >  DoCmd.OpenForm "frmSelectMSM", , , , , acDialog, TxtSearch
> >  Me.RecordSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
> > [ModelNumber]='" & gblSelection & "'"
> >
> > frmSelectMSM:
> >
> > Private Sub SearchListBox_DblClick(Cancel As Integer)
> >    gblSelection = SearchListBox
> > End Sub
> >
> > Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
> > SearchListBox.RowSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
> > [ModelNumber] LIKE '" & OpenArgs & "*'"
> > End Sub
> >
> > GLOBALMODULE:
> > Option Compare Database
> > Public gblSelection As String
> >
> > frmSelectMSM:
> > recordsource: tblMSM
> >
> > ListBox:
> > no control source
> > row source.....SELECT [MSM].[MSMID], [MSM].[ModelNumber] FROM [MSM];
> > -- 
> > need help
> >
> >
> > "Carl Rapson" wrote:
> >
> >> "Will G" <bigwillno2@yahoo.com> wrote in message
> >> news:E14F7B8A-5346-4357-B1EF-121F88C97901@microsoft.com...
> >> > Hey Carl,
> >> > thanks for your help, i guess it does work, only that, i got a little
> >> > comfuse with what i am doing and i would love for you to clarify it for
> >> > me....
> >> >
> >> > i have the main form "MSM"...this form contains a search text field and 
> >> > i
> >> > want to enter text here, a string, and when click the search button, i
> >> > want
> >> > to openup a different for that's named "frmSelectMSM" ...this form
> >> > contains a
> >> > list box with ModelNumber(string and could be for example A99000M), 
> >> > should
> >> > be
> >> > same field as the one entered in the search area txtbox.......this list
> >> > box
> >> > is the only item on this form....i want to filter this list if the user
> >> > enters "A" or if the user enters the entire ModelNumber. And when i 
> >> > select
> >> > one of this filtered ModelNumber, i like to populate the fields on the
> >> > main
> >> > form "MSM", that contains ModelNumber, and other fields. .....if you
> >> > understand this, can you help me with it?
> >> > -- 
> >> > need help
> >> >
> >> >
> >> <snipped>
> >>
> >> Let's try this again. There are two steps to this process: passing the 
> >> value
> >> from your search text field to the second form so that the listbox can be
> >> filtered, and returning the listbox selection to the first form so it can 
> >> be
> >> used to "populate the fields" (more on this later).
> >>
> >> For the first step, pass the value from the search text box to the second
> >> form in the OpenArgs parameter of the FormOpen method:
> >>
> >> DoCmd.OpenForm "frmSelectMSM",,,,,acDialog,txtSearchBox
> >>
> >> Be sure to use your own text box control name here. We open the second 
> >> form
> >> in Dialog mode so that the first form "pauses" until the second form 
> >> closes.
> >> In the Load event of the second form, "pick up" the value from the 
> >> OpenArgs
> >> parameter and use it to filter your listbox. I can't really give an 
> >> example
> >> here, because I don't know how you are populating the listbox with the 
> >> model
> >> number strings. If the listbox is bound to a table, you can just modify 
> >> the
> >> RowSource of the listbox to incorporate the value passed in OpenArgs:
> >>
> >> lstListBox.RowSource = "SELECT ... FROM ... WHERE [ModelNumber] LIKE '" &
> >> OpenArgs & "*'"
> >>
> >> I made up the name of the listbox control here, so be sure to use your
> >> actual control name. If you are populating the listbox by some other 
> >> method,
> >> you'll need to adjust it as needed to incorporate the value in OpenArgs.
> >>
> >> For the second step (returning the listbox selection back to the first
> >> form), you need to first create a module to define an application-level
> >> ("global") variable that can be used from both forms. Create a new module
> >> (or you can use an existing module if you have one) and add the variable
> >> declaration:
> >>
> >> Public gblSelection As String
> >>
> >> In the second form, in the DblClick event of the listbox (or whatever 
> >> other
> >> method you use to exit the form), store the listbox selection in the 
> >> global
> >> variable:
> >>
> >> gblSelection = lstListBox
> >>
> >> (be sure to use your own variable and control names here). Back in the 
> >> MSM
> >> form, immediately following the OpenForm call that opened the second 
> >> form,
> >> pick up the value from the global variable and use it to "filter" the MSM
> >> form:
> >>
> >> Me.RecordSource = "SELECT ... FROM ... WHERE [ModelNumber]='" & 
> >> gblSelection
> >> & "'"
> >>
> >> This assumes you're using an SQL statement for the form's RecordSource
> >> (which is what I prefer, for just this reason). If you're using a table 
> >> or
> >> query, you may want to use the form's Filter and FilterOn properties 
> >> instead
> >> (like in your previous question). If your MSM form is unbound, you can 
> >> fetch
> >> the record from the table yourself (with a Recordset) and populate the
> >> controls on the form.
> >>
> >> I don't know if there's more I can add to this without actually writing 
> >> the
> >> code for you. Study these examples, look in Access and VB Help, and 
> >> search
> >> these newsgroups for specifics. What you're trying to do is fairly common
> >> and has been addressed many times in these newsgroups.
> >>
> >> Good luck,
> >>
> >> Carl Rapson
> >>
> >>
> >> 
> 
> 
> 
0
Utf
3/20/2007 3:48:42 PM
Sorry, I'm fresh out of ideas. Based on what you've given me, I don't see 
anything else to try.

Carl Rapson

"Will G" <bigwillno2@yahoo.com> wrote in message 
news:3011DF17-06BD-43E5-89CF-CE31AC1E31C1@microsoft.com...
> Hey Carl
> again thanks for your help and for being patient with me....i did what you
> told me, got the searchListBox.Rowsource at the load even of the
> frmSelectMSM, but it doesnt work, all it does is open the form and this 
> time,
> the list shows no record. i have it set up just as stated in the previous
> post and with the change that you just suggested and still dont load with
> ModelNumbers sorted. any further suggestion?
> -- 
> need help
>
>
> "Carl Rapson" wrote:
>
>> In frmSelectMSM, you need to set SearchListBox.RowSource in the Form_Load
>> event, not the Form_Filter event.
>>
>> Carl Rapson
>>
>> "Will G" <bigwillno2@yahoo.com> wrote in message
>> news:76181599-EB00-4908-8C8E-658AC435D18A@microsoft.com...
>> > Hey Carl thanks for the help man, but i guess i am just gonna try
>> > something
>> > else because it's not working. the click event of the search fields 
>> > it's
>> > opening the other form but that's all it's doing. and again it might 
>> > not
>> > be
>> > something that i am not seeing since i have very little experience 
>> > doing
>> > this.  what did is this.....
>> > Main for:
>> > on clik
>> >  DoCmd.OpenForm "frmSelectMSM", , , , , acDialog, TxtSearch
>> >  Me.RecordSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
>> > [ModelNumber]='" & gblSelection & "'"
>> >
>> > frmSelectMSM:
>> >
>> > Private Sub SearchListBox_DblClick(Cancel As Integer)
>> >    gblSelection = SearchListBox
>> > End Sub
>> >
>> > Private Sub Form_Filter(Cancel As Integer, FilterType As Integer)
>> > SearchListBox.RowSource = "SELECT [MSM].[ModelNumber] FROM [MSM] WHERE
>> > [ModelNumber] LIKE '" & OpenArgs & "*'"
>> > End Sub
>> >
>> > GLOBALMODULE:
>> > Option Compare Database
>> > Public gblSelection As String
>> >
>> > frmSelectMSM:
>> > recordsource: tblMSM
>> >
>> > ListBox:
>> > no control source
>> > row source.....SELECT [MSM].[MSMID], [MSM].[ModelNumber] FROM [MSM];
>> > -- 
>> > need help
>> >
>> >

<snipped>


0
Carl
3/22/2007 3:49:01 PM
Reply:

Similar Artilces:

Copying different sized cell width & height onto another worksheet
My problem is i have made a worksheet for work to enter data for testin we perform, but on this worksheet i need to copy a graph from anothe worksheet. Problem is the graph worksheet cell widths are vey smal like 1.29 (38 cells) and height is 3.75 (93 cells), now if i copy the onto the other worksheet it will resize the cells to that worksheet and the graph will be huge like over 5 pages, and if i manually resiz the cells back to 1.29 you will be able to see the graph but wont b able to read the data, as the cell width is way to small. Is there way to copy a selection from a worksheet to ano...

Maintaing position of graphics withing a text area when text boxes are linked.
Using Publisher 2003. Making a catalog. A text box will cover a category. Within this category are several different product. Say 4 product. The decription of these four product can run into several pages. So I link these text boxes to make my life easier. One or more paragraphs are devoted to each product. Each product description includes an inserted graphic of the product beside the first paragraph of each product description. Later when I add or change text, the text flows from one text box to another. nice! however the graphics do not follow. So I end up moving each graphic ind...

Sub Form
How I will make many Sub Forms in Tabualr mode in one main form -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200708/1 suggest you don't open "many" subforms. there's a lot of overhead when you open multiple subforms in a single main form. since you're using a tab control, your users will only be able to see one subform at a time anyway; so you can use *one* subform control, put it on the main form "behind" the subform and it will show up on all the tabs. then use some code to load the appropriate sou...

Look for: Search In => Choose folders=> Search subfolders not working
When I search for an old email using Outlook's Look for: box and specify which folders to search in via the "Choose folders=>Search subfolders" checking a folder does not actually cause any subfolders to be checked. Unless there is some other setting and/or option hidden away somewhere, the "Search subfolders" check box is not working. I must manually check all the desired subfolders. What am I doing wrong? -- Regards, Peter Sale Santa Monica, CA USA To email me, just pull 'my-leg.' ...

Search last 4 digits in an (account number)
I store bank accunt and credit card numbers in various Contact Notes. For example, a credit card # as xxxxxxxxxxxx1234. Outlook contact search would not find this contact if I enter the search for "1234". Is there a way to do this in Outlook 2007? TIA PS - this search works fine in Outlook Mobile. outlook searches from the beginning - so it will only work if you use xxxxxxxxxxxx 1234. Other search tools (like google desktop) may find it. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: htt...

Vendor Email to POP Other Form
Can anyone give me directions on how to add the vendor's email address (from the vendor internet information window) to the Purchase Order Other Form? Thanks, Jocelyn Jocelyn, The vendor e-mail address is stored in SY01200 (Internet addresses). In that case, it might not be possible to bring that on to the PO form. Try adding the e-mail address in vendor maintenance Options window, user defined field so that you can place the same in the PO modified report. -- Thanks Janakiram M.P. MCP-GP Note: If you are a Microsoft Partner, You can also Login to Dynamics GP partner forums at ...

tabbed form issue
I have a main form with a couple of tabbed subforms. Everything works great except when using the scroll wheel on a mouse if I am on one of the tabbed subforms it rolls only the subform forward and then it is to a blank add form. I want my subform and mainform to scroll together record by record. If I use the record advance arrows on my main form my records advance perfectly. Thanks for the help in advance. ...

Attaching an open email message to another message
Hello, If I have opened a message (call it message-1) by some means (say from some desktop search application) and i'm composing another message (say, message-2), is there some easy way to attach message-1 to message-2? Currently, the only way I know of doing this is to find the Outlook folder where message-1 lives, hunt for message-1 there, and then drag it into message-2. If I already have message-1 opened, is there some shortcut to getting it into message-2? Thanks! No, whether message-1 is open or not has nothing to do with how you = attach it to message-2. --=20 Sue Mosher, Out...

Search & replace in formulae
Is it possible to do a search and replace which includes the cell formula contents ? I have a workbook that has cells which link to the contents of a cell in another workbook and I'd like to know if the naming has to remain constant or if I can replace a part of the name periodically. ie each year. thanks "Iain Rhodes" <iain@pricejam.com> wrote in message news:8ec201c49682$858c5d20$a501280a@phx.gbl... > Is it possible to do a search and replace which includes > the cell formula contents ? I have a workbook that has > cells which link to the contents of a cel...

How do I save a narrated (sound embedded) PPT07 file in SCORM form
I want to allow my company's LMS (Learning Management System) to store, push, and report viewership of narrated (Isound embedded) PPT 2007 files. The LMS has two APIs for content: SCORM 1.2 or AICC. Has anyone found a way to store narrated PPTs (or take intermediate steps) to create SCORM-format output so an LMS can manipulate it? ...

Searching for Newsgroups
I subscribe to a Usenet service for accessing various news groups. After I download all the newsgroups from that server I can not find a way to search for the newsgroups I have interest in. When I put something like "RV" in the search box on the top right corner, it searches all of my Emails rather than just the list of groups that had "RV" in the title. Help tells me that there is a " Display newsgroups containing" box but for the life of me I can't find it. Any thoughts out there? I am running Entourage 12.2.3 Dunc Click the bar in th...

Cannot Double Click to open Excel 2000 documents
I cannot double click on Excel 2000 documents and get them to open. I get an error stating it cannot find file: 'c:\file and path\Excel Spreadsheet filename.xls'. I have checked all the settings within Excel and cannot find anything that seems out of the ordinary. I have uninstalled and reinstalled Office. Word and other files work normally. I only have this problem in Excel Sometimes one of these works: Tools|Options|General|Ignore other applications (uncheck it) --- or --- Close Excel and Windows Start Button|Run excel /unregserver then Windows Start Button|Run excel...

1 excel file but 2 windows open
I receive a excel file from my workmate when I open this file, the excel windows open and display the same content, but the file name shown are different, e.g 1 windows show abc:1, another windows show abc:2 And the file owner dont know why the file become like this. Any setting make this effect ? and how to make it become a normal file? Thanks in advance Select the window which shows abc:2 and use the close icon for this window (not the Excel window) then save the file - when you subsequently open the file it will only show one window. You get this effect by clicking Window | New Window...

opening attachments #4
i use outlook express 6.0. whenever i receive an email with an attachment, it automatically sends it to windows media player to open(which says can't open, format not supported). no matter what format it is. I have cleared all supported formats in the media player and still get the same results. any help would be appreciated! This newsgroup is for support of Outlook 97, 98, 2000 & 2002 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows...

deleting a form
How do you delete a form from the organizational forms lib? Use Outlook, and go to Tools / Options / Other / Advanced Options / Custom Forms / Manage Forms -- Neil Hobson Exchange MVP For Exchange news, links and tips, check: http://www.msexchange.co.uk "scavngr" <aaa@winn-dixie.com> wrote in message news:020b01c3c9a2$e7485cb0$a501280a@phx.gbl... > How do you delete a form from the organizational forms lib? ...

Search engine optimization
Hello all! My question today regarding this issue is: I have noticed some sites have the following on their sites "Source". meta name= "robots" content="Index, follow" meta name= "revisit-after" content="15 days" or (30 days) What does this function accomplish as far as search engines go? and will it really imporve your results ( rankings) Like for instance "robots" "index, all" what is the difference between this and saying "robots" "index, follow" I'm a bit confused about this. Can someone ...

Change color on date field in form for re-certification
Hello. I have two different date fields on a form, but I would like them to change color depending on how close to the re-certification date it is whenever I open the form or open a report showing the same info. On each of the date fields, I would like to have them green for anything over a month away, yellow for anytime within a month, and red for anything expired. One date field [PTDate] needs re-certified every 6 months, and the other date field [WeaponDate] needs re-certified every 12 months. I've been struggling with this for several days now and haven't been able t...

Can I search identical fields from multiple tables?
I have a database to log details about staff in my school. I have a tables for staff details, courses, absence, educational visits etc. In each table I have a date field to show when the member of staff is not present. I want to produce a query to search all tables by entering a date - e.g. to bring back all results for staff who are not in school on a certiain day because they are either ill, on a course or on an educational visit. The query will work by entering a date once - it will then search all the other tables and bring back the results. Is this possible? Do I restructure? ...

What does outlook search when you search Contacts ?
When you do a search in oulook for contacts, what is the criteria that outlook searches? Or I guess how does outlook search? Why is it not consistant? The reason I am asking is that we have our customers contacts in public folders. In our customers we have 6 contacts for XYZ Foods. If you search in outlook for just "XYZ" it only comes back with 4 of the six. If you do a search for "XYZ Foods" it returns with all 6. And if you just entered "Foods" no contacts were found. And we actually have a few companies in our contacts who's names are a two part name ending...

Tally lists based on results
I need to calculate how many alike products are chosen in a table from data tables (validated data) to show a tally. How on earth do you do this? How do i calculate how many "Blue" items are listed each time a Blue item is added to the list etc? Each time a new item is listed, it will automatically appear in the tally list as a new item and/or count tally. There is a possibilty of 1000 items though commonly only a maximum of 10 should appear in the tally. eg. The data collected by input. A B 1 Blue $50 2 Red $40 3 Blue $50 4 Orange $20 5 Blue $50 6 Orange $20 etc In this exam...

Telephone Message Area in Outlook
I am unsure of which version of Outlook has the option where you can place telephone messages in which your co- workers/managers can view and edit. Is there a specific add-in required? I know that some companies have this function in Outlook, but I would like to find out if this is a created Form in Outlook or if it is a new option in the newer versions. You could do that in a Public Journal Folder, I suppose. That would require an Exchange server to host it. -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr **I apologize but I am unable to respond to dire...

Outlook won't open because error msg
When I click on Outlook, It tells me: unable to open your default email folders. The file C:....outlook.pst is not a personal folders file. I tried to restore and later to repair my outlook windows component file. Do I have to uninstall and reinstall outlook completely? My addresses were on there at one point, and I didn't change a thing. I considered syncing my Yahoo address book with my desktop, but didn't. Instead I only copied my yahoo addresses to a .csv file. I thought maybe my hotsync downnload from my handheld to my desktop might have interrupted something. Is th...

cannot open older word doc with office 2007
When I attempt to open and older word document I get an error that the file type was blocked by your registry policy setting in word 2007 or word 2003. I looked up knowledge base article 922849 and it states to go to HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Word\Security\FileOpenBlock Only problem is that after microsoft in the tree there is no office. Make sure you going down the correct tree in the Reg Editor. There MUST be an Office section, so you must be following the wrong tree. -- Terry Farrell - MSWord MVP "bob" <rlabonte@verizon.n...

excel VBA
How would i search a range of a whole column instead of specific cells like .Range("a1:a300")? --- Message posted from http://www.ExcelForum.com/ ..range("a:a") ..columns(1) ..range("a1").entirecolumn are a few ways. "Zygoid <" wrote: > > How would i search a range of a whole column instead of specific cells > like .Range("a1:a300")? > > --- > Message posted from http://www.ExcelForum.com/ -- Dave Peterson ec35720@msn.com ahhh! Thanks!! I was trying .Column(1) i see i neede an "s" in there Thanks a...

Refresh a combo box on a sub-form
Hi, While in the main form, I want to requery / refresh a combo box on a sub-form. Ive read a couple of forum discussion concerning this issue and tried them, but it did not work. I'm doing somthing dumb. My main form name is frmFamily My sub-form name is frmFamily-sfMembers The name of the combo box on the frmFamily-sfMembers is cboMemNo While in the main form, I want to have Access requery cboMemNo on the frmFamily-sfMembers. While in the main form, I've tried: Me!frmFamily-sfMembers.Form!cboMemNo.Requery This results in the error message "Acces...