PC Review


Reply
Thread Tools Rate Thread

Creating a que

 
 
KJ MAN
Guest
Posts: n/a
 
      17th Sep 2008
I need my program to create a revolving cue from entries made by individuals.

If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
should list the entries as so:
1.)Sally 7.)Kelly
2.)George 8.)Sally
3.)Pat 9.)Kelly
4.)Kelly 10.)Kelly
5.)Sally 11.)Kelly
6.)George
If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
the script would be

10.)Don
11.)Kelly
12.)Don
13.)Kelly

Any suggestions on this?

 
Reply With Quote
 
 
 
 
Bob Bridges
Guest
Posts: n/a
 
      17th Sep 2008
I'm guessing that when you type "que" and "cue" you're looking for "queue",
meaning a line of people waiting to get into a theater or a stack of items
waiting to be processed. Seems to me the trick here is to store each name
and entry count in a collection. Then start looping through the collection,
checking the entry count and, if it's >0, listing the name and decrementing
the count, until every item in empty. Like this:

Do
bMoreData = False
For Each eo In Entries
If eo.Count > 0 Then
MsgBox eo.Name
eo.Count = eo.Count - 1
if eo.Count > 0 then bMoreData = True
End If
Next eo
Loop While bMoreData

At the beginning of the loop you assume this is the last time through the
loop (bMoreData = False). Then you go through each item in the Entries
collection, which has a name (Kelly, Pat etc) and a count (however many
entries they created). If the count is still >0, my code above just MsgBoxed
the name, but you'll insert code there to create a new item in your list,
consisting of the person's name, and then you decrement that person's entry
count. If his entry count isn't 0 yet, you're going to do another loop, so
turn on bMoreData too.

As long as every person has more entries to do, their names are listed in
order. As soon as one's count has been reduced to 0, that person will no
longer continue being listed -- but the loop will continue, the others being
listed, until each one has been "listed out".

I didn't get into details you may already understand, like how to create a
collection and how to create an entry in your list. But if you need help on
some other aspect, don't hesitate to ask.

--- "KJ MAN" wrote:
> I need my program to create a revolving cue from entries made by individuals.
>
> If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> should list the entries as so:
> 1.)Sally 7.)Kelly
> 2.)George 8.)Sally
> 3.)Pat 9.)Kelly
> 4.)Kelly 10.)Kelly
> 5.)Sally 11.)Kelly
> 6.)George
> If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> the script would be
>
> 10.)Don
> 11.)Kelly
> 12.)Don
> 13.)Kelly
>
> Any suggestions on this?

 
Reply With Quote
 
KJ MAN
Guest
Posts: n/a
 
      17th Sep 2008
Well, I was pretty fluent in QBASIC Years ago and I did some
VB scripting about 3 years ago but I have lot most of it. I will try
your code and then use some trial and error to see if I can get it to
work with the rest of my sheets. If you have any up-front suggestions
on how to create and maintain my list I'm all ears. I'd like to get this
project
ready to go by Saturday and I sill must restructure the a 6000 strong
file/folder
database.

Thanks

"Bob Bridges" wrote:

> I'm guessing that when you type "que" and "cue" you're looking for "queue",
> meaning a line of people waiting to get into a theater or a stack of items
> waiting to be processed. Seems to me the trick here is to store each name
> and entry count in a collection. Then start looping through the collection,
> checking the entry count and, if it's >0, listing the name and decrementing
> the count, until every item in empty. Like this:
>
> Do
> bMoreData = False
> For Each eo In Entries
> If eo.Count > 0 Then
> MsgBox eo.Name
> eo.Count = eo.Count - 1
> if eo.Count > 0 then bMoreData = True
> End If
> Next eo
> Loop While bMoreData
>
> At the beginning of the loop you assume this is the last time through the
> loop (bMoreData = False). Then you go through each item in the Entries
> collection, which has a name (Kelly, Pat etc) and a count (however many
> entries they created). If the count is still >0, my code above just MsgBoxed
> the name, but you'll insert code there to create a new item in your list,
> consisting of the person's name, and then you decrement that person's entry
> count. If his entry count isn't 0 yet, you're going to do another loop, so
> turn on bMoreData too.
>
> As long as every person has more entries to do, their names are listed in
> order. As soon as one's count has been reduced to 0, that person will no
> longer continue being listed -- but the loop will continue, the others being
> listed, until each one has been "listed out".
>
> I didn't get into details you may already understand, like how to create a
> collection and how to create an entry in your list. But if you need help on
> some other aspect, don't hesitate to ask.
>
> --- "KJ MAN" wrote:
> > I need my program to create a revolving cue from entries made by individuals.
> >
> > If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> > should list the entries as so:
> > 1.)Sally 7.)Kelly
> > 2.)George 8.)Sally
> > 3.)Pat 9.)Kelly
> > 4.)Kelly 10.)Kelly
> > 5.)Sally 11.)Kelly
> > 6.)George
> > If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> > the script would be
> >
> > 10.)Don
> > 11.)Kelly
> > 12.)Don
> > 13.)Kelly
> >
> > Any suggestions on this?

 
Reply With Quote
 
Bob Bridges
Guest
Posts: n/a
 
      17th Sep 2008
QBasic won't help you; I used it, too, but its only relationship to Visual
Basic is the underlying syntax. A collection, in the OO sense, is more like
an array than anything else we've met in QBasic, the main differences being
a) what's stored is not a value but the variable or object itself, b) each
item in the collection can be referred to by name as well as by index number,
and c) the items don't all have to be of the same type.

I'd be happy to explain collections and fill in other gaps you're missing,
but perhaps in the interest of time you'd prefer, meanwhile, to do this with
arrays. I don't use arrays, much, since a more experienced VBA programmer
turned me on to collections, but they'll work fine in this case. Put your
count in one array and the names in the other, then:

Do
bMoreData = False
For ie = 0 to UBound(Count)
If Count(ie) > 0 Then
MsgBox Name(ie)
Count(ie) = Count(ie) - 1
if Count(ie) > 0 then bMoreData = True
End If
Next eo
Loop While bMoreData

I just naturally use collections whenever I don't know ahead of time how
many items I might have to load.

As for Collections, it sounds like you could do with a quick refresher on
the nature of objects and work up from there. If you want to, contact me via
email and we can go into it in as much depth as you feel like.

--- "KJ MAN" wrote:
> Well, I was pretty fluent in QBASIC Years ago and I did some
> VB scripting about 3 years ago but I have lot most of it. I will try
> your code and then use some trial and error to see if I can get it to
> work with the rest of my sheets. If you have any up-front suggestions
> on how to create and maintain my list I'm all ears. I'd like to get this
> project ready to go by Saturday and I sill must restructure the a 6000
> strong file/folder database.
>
> --- "Bob Bridges" wrote:
> > I'm guessing that when you type "que" and "cue" you're looking for "queue",
> > meaning a line of people waiting to get into a theater or a stack of items
> > waiting to be processed. Seems to me the trick here is to store each name
> > and entry count in a collection. Then start looping through the collection,
> > checking the entry count and, if it's >0, listing the name and decrementing
> > the count, until every item in empty. Like this:
> >
> > Do
> > bMoreData = False
> > For Each eo In Entries
> > If eo.Count > 0 Then
> > MsgBox eo.Name
> > eo.Count = eo.Count - 1
> > if eo.Count > 0 then bMoreData = True
> > End If
> > Next eo
> > Loop While bMoreData
> >
> > At the beginning of the loop you assume this is the last time through the
> > loop (bMoreData = False). Then you go through each item in the Entries
> > collection, which has a name (Kelly, Pat etc) and a count (however many
> > entries they created). If the count is still >0, my code above just MsgBoxed
> > the name, but you'll insert code there to create a new item in your list,
> > consisting of the person's name, and then you decrement that person's entry
> > count. If his entry count isn't 0 yet, you're going to do another loop, so
> > turn on bMoreData too.
> >
> > As long as every person has more entries to do, their names are listed in
> > order. As soon as one's count has been reduced to 0, that person will no
> > longer continue being listed -- but the loop will continue, the others being
> > listed, until each one has been "listed out".
> >
> > I didn't get into details you may already understand, like how to create a
> > collection and how to create an entry in your list. But if you need help on
> > some other aspect, don't hesitate to ask.
> >
> > --- "KJ MAN" wrote:
> > > I need my program to create a revolving cue from entries made by
> > > individuals.
> > >
> > > If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> > > should list the entries as so:
> > > 1.)Sally 7.)Kelly
> > > 2.)George 8.)Sally
> > > 3.)Pat 9.)Kelly
> > > 4.)Kelly 10.)Kelly
> > > 5.)Sally 11.)Kelly
> > > 6.)George
> > > If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> > > the script would be
> > >
> > > 10.)Don
> > > 11.)Kelly
> > > 12.)Don
> > > 13.)Kelly

 
Reply With Quote
 
KJ MAN
Guest
Posts: n/a
 
      22nd Sep 2008
I would like to contact you via email and get aquainted with collections a
little.
I love vb programming, its just so hard to get the time to learn.

"Bob Bridges" wrote:

> QBasic won't help you; I used it, too, but its only relationship to Visual
> Basic is the underlying syntax. A collection, in the OO sense, is more like
> an array than anything else we've met in QBasic, the main differences being
> a) what's stored is not a value but the variable or object itself, b) each
> item in the collection can be referred to by name as well as by index number,
> and c) the items don't all have to be of the same type.
>
> I'd be happy to explain collections and fill in other gaps you're missing,
> but perhaps in the interest of time you'd prefer, meanwhile, to do this with
> arrays. I don't use arrays, much, since a more experienced VBA programmer
> turned me on to collections, but they'll work fine in this case. Put your
> count in one array and the names in the other, then:
>
> Do
> bMoreData = False
> For ie = 0 to UBound(Count)
> If Count(ie) > 0 Then
> MsgBox Name(ie)
> Count(ie) = Count(ie) - 1
> if Count(ie) > 0 then bMoreData = True
> End If
> Next eo
> Loop While bMoreData
>
> I just naturally use collections whenever I don't know ahead of time how
> many items I might have to load.
>
> As for Collections, it sounds like you could do with a quick refresher on
> the nature of objects and work up from there. If you want to, contact me via
> email and we can go into it in as much depth as you feel like.
>
> --- "KJ MAN" wrote:
> > Well, I was pretty fluent in QBASIC Years ago and I did some
> > VB scripting about 3 years ago but I have lot most of it. I will try
> > your code and then use some trial and error to see if I can get it to
> > work with the rest of my sheets. If you have any up-front suggestions
> > on how to create and maintain my list I'm all ears. I'd like to get this
> > project ready to go by Saturday and I sill must restructure the a 6000
> > strong file/folder database.
> >
> > --- "Bob Bridges" wrote:
> > > I'm guessing that when you type "que" and "cue" you're looking for "queue",
> > > meaning a line of people waiting to get into a theater or a stack of items
> > > waiting to be processed. Seems to me the trick here is to store each name
> > > and entry count in a collection. Then start looping through the collection,
> > > checking the entry count and, if it's >0, listing the name and decrementing
> > > the count, until every item in empty. Like this:
> > >
> > > Do
> > > bMoreData = False
> > > For Each eo In Entries
> > > If eo.Count > 0 Then
> > > MsgBox eo.Name
> > > eo.Count = eo.Count - 1
> > > if eo.Count > 0 then bMoreData = True
> > > End If
> > > Next eo
> > > Loop While bMoreData
> > >
> > > At the beginning of the loop you assume this is the last time through the
> > > loop (bMoreData = False). Then you go through each item in the Entries
> > > collection, which has a name (Kelly, Pat etc) and a count (however many
> > > entries they created). If the count is still >0, my code above just MsgBoxed
> > > the name, but you'll insert code there to create a new item in your list,
> > > consisting of the person's name, and then you decrement that person's entry
> > > count. If his entry count isn't 0 yet, you're going to do another loop, so
> > > turn on bMoreData too.
> > >
> > > As long as every person has more entries to do, their names are listed in
> > > order. As soon as one's count has been reduced to 0, that person will no
> > > longer continue being listed -- but the loop will continue, the others being
> > > listed, until each one has been "listed out".
> > >
> > > I didn't get into details you may already understand, like how to create a
> > > collection and how to create an entry in your list. But if you need help on
> > > some other aspect, don't hesitate to ask.
> > >
> > > --- "KJ MAN" wrote:
> > > > I need my program to create a revolving cue from entries made by
> > > > individuals.
> > > >
> > > > If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> > > > should list the entries as so:
> > > > 1.)Sally 7.)Kelly
> > > > 2.)George 8.)Sally
> > > > 3.)Pat 9.)Kelly
> > > > 4.)Kelly 10.)Kelly
> > > > 5.)Sally 11.)Kelly
> > > > 6.)George
> > > > If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> > > > the script would be
> > > >
> > > > 10.)Don
> > > > 11.)Kelly
> > > > 12.)Don
> > > > 13.)Kelly

 
Reply With Quote
 
Bob Bridges
Guest
Posts: n/a
 
      22nd Sep 2008
Well, don't TELL me you'd like to contact me, just contact me! My email
address is in my profile; just click on the link where it says "By: Bob
Bridges" and remove the anti-spam node and you have my email address.

And yeah, I love it too.

--- "KJ MAN" wrote:
> I would like to contact you via email and get aquainted with collections a
> little. I love vb programming, its just so hard to get the time to learn.
>
> --- "Bob Bridges" wrote:
> > QBasic won't help you; I used it, too, but its only relationship to Visual
> > Basic is the underlying syntax. A collection, in the OO sense, is more like
> > an array than anything else we've met in QBasic, the main differences being
> > a) what's stored is not a value but the variable or object itself, b) each
> > item in the collection can be referred to by name as well as by index number,
> > and c) the items don't all have to be of the same type.
> >
> > I'd be happy to explain collections and fill in other gaps you're missing,
> > but perhaps in the interest of time you'd prefer, meanwhile, to do this with
> > arrays....As for Collections, it sounds like you could do with a quick refresher
> > on the nature of objects and work up from there. If you want to, contact me
> > via email and we can go into it in as much depth as you feel like.
> >
> > --- "KJ MAN" wrote:
> > > Well, I was pretty fluent in QBASIC Years ago and I did some
> > > VB scripting about 3 years ago but I have lot most of it. I will try
> > > your code and then use some trial and error to see if I can get it to
> > > work with the rest of my sheets. If you have any up-front suggestions
> > > on how to create and maintain my list I'm all ears. I'd like to get this
> > > project ready to go by Saturday and I sill must restructure the a 6000
> > > strong file/folder database.
> > >
> > > --- "Bob Bridges" wrote:
> > > > I'm guessing that when you type "que" and "cue" you're looking for "queue",
> > > > meaning a line of people waiting to get into a theater or a stack of items
> > > > waiting to be processed. Seems to me the trick here is to store each name
> > > > and entry count in a collection. Then start looping through the collection,
> > > > checking the entry count and, if it's >0, listing the name and decrementing
> > > > the count, until every item in empty. Like this:
> > > >
> > > > Do
> > > > bMoreData = False
> > > > For Each eo In Entries
> > > > If eo.Count > 0 Then
> > > > MsgBox eo.Name
> > > > eo.Count = eo.Count - 1
> > > > if eo.Count > 0 then bMoreData = True
> > > > End If
> > > > Next eo
> > > > Loop While bMoreData
> > > >
> > > > At the beginning of the loop you assume this is the last time through the
> > > > loop (bMoreData = False). Then you go through each item in the Entries
> > > > collection, which has a name (Kelly, Pat etc) and a count (however many
> > > > entries they created). If the count is still >0, my code above just MsgBoxed
> > > > the name, but you'll insert code there to create a new item in your list,
> > > > consisting of the person's name, and then you decrement that person's entry
> > > > count. If his entry count isn't 0 yet, you're going to do another loop, so
> > > > turn on bMoreData too.
> > > >
> > > > As long as every person has more entries to do, their names are listed in
> > > > order. As soon as one's count has been reduced to 0, that person will no
> > > > longer continue being listed -- but the loop will continue, the others being
> > > > listed, until each one has been "listed out".
> > > >
> > > > I didn't get into details you may already understand, like how to create a
> > > > collection and how to create an entry in your list. But if you need help on
> > > > some other aspect, don't hesitate to ask.
> > > >
> > > > --- "KJ MAN" wrote:
> > > > > I need my program to create a revolving cue from entries made by
> > > > > individuals.
> > > > >
> > > > > If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> > > > > should list the entries as so:
> > > > > 1.)Sally 7.)Kelly
> > > > > 2.)George 8.)Sally
> > > > > 3.)Pat 9.)Kelly
> > > > > 4.)Kelly 10.)Kelly
> > > > > 5.)Sally 11.)Kelly
> > > > > 6.)George
> > > > > If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> > > > > the script would be
> > > > >
> > > > > 10.)Don
> > > > > 11.)Kelly
> > > > > 12.)Don
> > > > > 13.)Kelly

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with creating query or creating report Need Help Microsoft Access Database Table Design 0 29th Apr 2008 02:22 AM
Creating VBA Functions When Creating Spreadsheet Via VBA? PeteCresswell Microsoft Excel Programming 6 18th Jun 2007 12:38 PM
creating PDF from msword - I get error while creating bookmarks =?Utf-8?B?bWFyay1uZWVkcy1oZWxw?= Microsoft Word Document Management 1 1st Nov 2005 05:48 AM
Auto creating text fields when creating new slide. =?Utf-8?B?amFtZXM=?= Microsoft Powerpoint 1 16th Jun 2005 04:02 PM
Walkthrough: Creating a Dist. App. - problems creating project =?Utf-8?B?R2FyeURvdE5ldA==?= Microsoft Dot NET 1 12th Aug 2004 03:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:28 AM.