Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 15 May 2006 15:54:34 +0200,    group: microsoft.public.word.vba.userforms        back       


Picking records/rows from a recordset   
Hi

I have a recordset containing rows selected by a SELECT command.
I want to present the selected rows in a list, grid or .... and give the
user the option to select one or more of the presented rows using a check
box or something like that.
Afterwards I want to do something with the checked rows, when the user
presses a command button.

How am I solving this problem in the right way?

Ebbe
date: Mon, 15 May 2006 15:54:34 +0200   author:   Ebbe ETk

Re: Picking records/rows from a recordset   
"Ebbe" <REMOVE_CAPS_eFGsSFhDG@DDJgEiDGtDsD.DJdRETk> wrote in message 
news:ug9PacCeGHA.1320@TK2MSFTNGP04.phx.gbl...
> Hi
>
> I have a recordset containing rows selected by a SELECT command.
> I want to present the selected rows in a list, grid or .... and give the
> user the option to select one or more of the presented rows using a check
> box or something like that.
> Afterwards I want to do something with the checked rows, when the user
> presses a command button.
>
> How am I solving this problem in the right way?


Sounds like you want to load the data into a ListBox. Set the MultiSelect 
property of the Listbox to True. Then you can read the Selected property of 
each item in the listbox to see whether the user has selected it.


-- 
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
date: Mon, 15 May 2006 15:08:47 +0100   author:   Jonathan West

Re: Picking records/rows from a recordset   
It looks like a plausible solution.

How do I bind the rows in the recordset and the rows in the listbox?
I know how to walk through a recordset and insert rows in a listbox.
But how do I go back to the correct row in the recordset, when I have a 
selected row in the listbox?

Ebbe
"Jonathan West"  skrev i en meddelelse 
news:%23EsXQlCeGHA.3948@TK2MSFTNGP03.phx.gbl...
>
> "Ebbe" <REMOVE_CAPS_eFGsSFhDG@DDJgEiDGtDsD.DJdRETk> wrote in message 
> news:ug9PacCeGHA.1320@TK2MSFTNGP04.phx.gbl...
>> Hi
>>
>> I have a recordset containing rows selected by a SELECT command.
>> I want to present the selected rows in a list, grid or .... and give the
>> user the option to select one or more of the presented rows using a check
>> box or something like that.
>> Afterwards I want to do something with the checked rows, when the user
>> presses a command button.
>>
>> How am I solving this problem in the right way?
>
>
> Sounds like you want to load the data into a ListBox. Set the MultiSelect 
> property of the Listbox to True. Then you can read the Selected property 
> of each item in the listbox to see whether the user has selected it.
>
>
> -- 
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
date: Mon, 15 May 2006 18:35:24 +0200   author:   Ebbe

Re: Picking records/rows from a recordset   
Where exactly is this recordset?  If it's in Access, you will probably 
better off doing the whole thing in Access.

-- 
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Ebbe"  wrote in message 
news:OR4yS2DeGHA.3556@TK2MSFTNGP02.phx.gbl...
> It looks like a plausible solution.
>
> How do I bind the rows in the recordset and the rows in the listbox?
> I know how to walk through a recordset and insert rows in a listbox.
> But how do I go back to the correct row in the recordset, when I have a 
> selected row in the listbox?
>
> Ebbe
> "Jonathan West"  skrev i en meddelelse 
> news:%23EsXQlCeGHA.3948@TK2MSFTNGP03.phx.gbl...
>>
>> "Ebbe" <REMOVE_CAPS_eFGsSFhDG@DDJgEiDGtDsD.DJdRETk> wrote in message 
>> news:ug9PacCeGHA.1320@TK2MSFTNGP04.phx.gbl...
>>> Hi
>>>
>>> I have a recordset containing rows selected by a SELECT command.
>>> I want to present the selected rows in a list, grid or .... and give the
>>> user the option to select one or more of the presented rows using a 
>>> check
>>> box or something like that.
>>> Afterwards I want to do something with the checked rows, when the user
>>> presses a command button.
>>>
>>> How am I solving this problem in the right way?
>>
>>
>> Sounds like you want to load the data into a ListBox. Set the MultiSelect 
>> property of the Listbox to True. Then you can read the Selected property 
>> of each item in the listbox to see whether the user has selected it.
>>
>>
>> -- 
>> Regards
>> Jonathan West - Word MVP
>> www.intelligentdocuments.co.uk
>> Please reply to the newsgroup
>> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>
date: Mon, 15 May 2006 19:21:04 +0200   author:   Doug Robbins - Word MVP

Re: Picking records/rows from a recordset   
Hi Doug

I am connecting to a MS-Access database through ODBC
First the user type in some search patterns in a userform and then presses a 
"search" button.
This results in a SELECT statement, I use in the <resordset>.Open.
It is the result of this selection/Open, I want to present and let the user 
choose among these rows.
When the user presses a "Process" button, I do some updates in the selected 
rows in the recordset.
(And precent the result in the active document).

Is this information enough?


"Doug Robbins - Word MVP"  skrev i en meddelelse 
news:OsSa2PEeGHA.4912@TK2MSFTNGP05.phx.gbl...
> Where exactly is this recordset?  If it's in Access, you will probably 
> better off doing the whole thing in Access.
>
> -- 
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Ebbe"  wrote in message 
> news:OR4yS2DeGHA.3556@TK2MSFTNGP02.phx.gbl...
>> It looks like a plausible solution.
>>
>> How do I bind the rows in the recordset and the rows in the listbox?
>> I know how to walk through a recordset and insert rows in a listbox.
>> But how do I go back to the correct row in the recordset, when I have a 
>> selected row in the listbox?
>>
>> Ebbe
>> "Jonathan West"  skrev i en meddelelse 
>> news:%23EsXQlCeGHA.3948@TK2MSFTNGP03.phx.gbl...
>>>
>>> "Ebbe" <REMOVE_CAPS_eFGsSFhDG@DDJgEiDGtDsD.DJdRETk> wrote in message 
>>> news:ug9PacCeGHA.1320@TK2MSFTNGP04.phx.gbl...
>>>> Hi
>>>>
>>>> I have a recordset containing rows selected by a SELECT command.
>>>> I want to present the selected rows in a list, grid or .... and give 
>>>> the
>>>> user the option to select one or more of the presented rows using a 
>>>> check
>>>> box or something like that.
>>>> Afterwards I want to do something with the checked rows, when the user
>>>> presses a command button.
>>>>
>>>> How am I solving this problem in the right way?
>>>
>>>
>>> Sounds like you want to load the data into a ListBox. Set the 
>>> MultiSelect property of the Listbox to True. Then you can read the 
>>> Selected property of each item in the listbox to see whether the user 
>>> has selected it.
>>>
>>>
>>> -- 
>>> Regards
>>> Jonathan West - Word MVP
>>> www.intelligentdocuments.co.uk
>>> Please reply to the newsgroup
>>> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>>
>>
>
>
date: Mon, 15 May 2006 20:08:03 +0200   author:   Ebbe

Re: Picking records/rows from a recordset   
Hi Ebbe, 

> How do I bind the rows in the recordset and the rows in the listbox?
> I know how to walk through a recordset and insert rows in a listbox.
> But how do I go back to the correct row in the recordset, when I have a 
> selected row in the listbox?
>
Well, there's no way to "bind" the recordset. you have to put something in 
the list that will let you go back to the recordset and look up the 
user's choice. If you can't rely on the Index of the selected item 
(first, second, third entry in the list), then you have to pick up a value 
from a column in the list and requery the data source based on that. 
usually, that would be the primary key...

You should be able to hide any column by setting its width to 0, and you 
can also set the Bound column to this column. Read up in the VBA Help on 
the BoundColumn property to see how to use it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or 
reply in the newsgroup and not by e-mail :-)
date: Tue, 16 May 2006 17:29:15 +0200   author:   Cindy M -WordMVP-

Re: Picking records/rows from a recordset   
Hi Cindy

I have an acceptable result setting the index to the list, when I execute 
rs.MoveFirst and count the index  up by One when I execute rs.MoveNext.
In this way I am walking through the list and the recordset synchronously.

I  close the case here with thanks for answers I have got.

Ebbe

"Cindy M -WordMVP-"  skrev i en meddelelse 
news:VA.0000bf8f.00ad68d2@speedy...
> Hi Ebbe,
>
>> How do I bind the rows in the recordset and the rows in the listbox?
>> I know how to walk through a recordset and insert rows in a listbox.
>> But how do I go back to the correct row in the recordset, when I have a
>> selected row in the listbox?
>>
> Well, there's no way to "bind" the recordset. you have to put something in
> the list that will let you go back to the recordset and look up the
> user's choice. If you can't rely on the Index of the selected item
> (first, second, third entry in the list), then you have to pick up a value
> from a column in the list and requery the data source based on that.
> usually, that would be the primary key...
>
> You should be able to hide any column by setting its width to 0, and you
> can also set the Bound column to this column. Read up in the VBA Help on
> the BoundColumn property to see how to use it.
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
>
date: Tue, 16 May 2006 22:25:23 +0200   author:   Ebbe

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us