Simple loop question

Hello, I have a control that has a number in it (e.g. 5) I need to repeat a 
task for the of time in my control. I guess it should be something like

Dim MyCounter as long

MyCounter = me.counter 

Do while  myCounter = 0

....do something

mycounter = mycounter -1
loop

Thak you,
Silvio
0
Utf
12/2/2009 11:04:02 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
492 Views

Similar Articles

[PageSpeed] 24

Change the "Do while  myCounter = 0" line to:

Do while  myCounter > 0

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page: 
http://www.askdoctoraccess.com/DownloadPage.htm


"Silvio" wrote:

> Hello, I have a control that has a number in it (e.g. 5) I need to repeat a 
> task for the of time in my control. I guess it should be something like
> 
> Dim MyCounter as long
> 
> MyCounter = me.counter 
> 
> Do while  myCounter = 0
> 
> ...do something
> 
> mycounter = mycounter -1
> loop
> 
> Thak you,
> Silvio
0
Utf
12/2/2009 11:24:01 PM
Silvio wrote:

>Hello, I have a control that has a number in it (e.g. 5) I need to repeat a 
>task for the of time in my control. I guess it should be something like
>
>Dim MyCounter as long
>
>MyCounter = me.counter 
>
>Do while  myCounter = 0
>
>...do something
>
>mycounter = mycounter -1
>loop

A little simpler to use:

Dim MyCounter as long
For MyCounter = 1 To me.counter 
	...do something
Next MyCounter

-- 
Marsh
MVP [MS Access]
0
Marshall
12/3/2009 12:04:04 AM
Tnank you Marshall and B., that works great!

"Marshall Barton" wrote:

> Silvio wrote:
> 
> >Hello, I have a control that has a number in it (e.g. 5) I need to repeat a 
> >task for the of time in my control. I guess it should be something like
> >
> >Dim MyCounter as long
> >
> >MyCounter = me.counter 
> >
> >Do while  myCounter = 0
> >
> >...do something
> >
> >mycounter = mycounter -1
> >loop
> 
> A little simpler to use:
> 
> Dim MyCounter as long
> For MyCounter = 1 To me.counter 
> 	...do something
> Next MyCounter
> 
> -- 
> Marsh
> MVP [MS Access]
> .
> 
0
Utf
12/3/2009 1:46:02 AM
Reply:

Similar Artilces:

Perplexing question
I have been using Money in one form or another from 2000. I now am running 2006. I have a slightly different question from the standard Archive question... I dont want to keep the transactions from prior years. Say every transaction before 1/1/2006 I would like to delete. And then I would like to delete all the empty and ancient accounts that have been canceld or, as in the asset case like a House, sold. I am trying to not loose all the account information. I do not want to have to reenter all the addresses, passwords, and the good transaction data from 2006 forward. I...

Student With A Question On MS Office 2007 Ribbon
I am working on a Excel problem for homework and I can't find the Solver Icon on the Ribbon in the Analysis Group on Data Tab. As far as I can tell this doesn't seem to be a techical issue. But why the Analysis group is not appearing on the far right on the Ribbon I am not sure. This is a brand new piece of MS Office software that I have installed and am working with. Why is this? I think you need to get the "Add-in". Select the Button - Excel Options - Add-Ins - Analysis Toolpak Follow instructions "Eddy" wrote: > I am working on a E...

basic threading question
Hi, In my application I create 4 new threads that each do the same code, but do different amounts of work. The process repeats over and over, so I create the 4 threads many times. I think however I am not killing of the threads when I am done, so I am ending up with 8,12,16 etc threads as it repeats. When each thread completes its work load, how do I kill it off properly. For example Thread1 = New Thread(AddressOf ThreadWorkLoad1Job.runBatch) Thread1.Start() Thread2 = New Thread(AddressOf ThreadWorkLoad2Job.runBatch) Thread2.Start() sub runbatch process a bun...

Is there anyone here still answering questions?
Where is everyone? Hi, Valorie. I'm here. What's your question? After September 12, you'll still find many (most?) of us in this same newsgroup on your favorite Usenet news server. My ISP includes a news server in my monthly subscriber fee, so I'm covered. If I weren't, I'd probably review the messages here were several free servers have been recommended. Or I'd Google or Bing for "free news server"; last time I tried that I got a few million hits! RC -- R. C. White, CPA San Marcos, TX rc@grandecom.net Microsoft Windows MVP ...

Creating a simple windows messaging app
Hi there, a broker app that receives packets from a canbus and pushes them out to multiple applications. there are two types of threads the broker will have: the main loop and the "app" thread The broker has a main loop that essentially sits and waits for two types of messages: -wm_canlib : canlib notifies the broker by sending a wm_canlib message to a window handle that I assign. the broker then takes the packet and then gives each application thread a copy of the packet. -(userdefined appregister) : front end applications that want to receieve packets will broadcast...

Set of questions !!!!
Hi, i have set of questions for the group a- can we remove Subject , COntracts and Contract Line fields from the Case form b- i get an error while trying to Exporting to Excel as dynamics pivot table. When i try to drag and drop the fields, i get a series of errors that say that there is no "underlying data", "no trusted connection to SQL server" etc. c- can we have one privileged user go and change/set the "work hours" for a set of users? d-can we track failed emails in CRM (when i send mails from CRM - either from IE or from Workflow ) . For e.g. if the c...

Question for Retail Realm
I need a add-on that fixes issues and addresses the limitations of the purchase order function of SO. Put simply, the thing doesn't update enough info on the ordered items. Cancel this. "Derek" wrote: > I need a add-on that fixes issues and addresses the limitations of the > purchase order function of SO. Put simply, the thing doesn't update enough > info on the ordered items. ...

ADC question #2
ADC is installed an is doing its synch. BUt when i create a test account in AD , it wont create mailbox in mail 5.5 by itself... is this right SO is with creation of a security group in AD, wont create distro in exchnage ?? i am yet to install first exchange 2003 any suggestions. ( objects wchih got replicated from exchange to AD and vise vera, if i change their attribute,, they get replcated fine ) ...

Simple Format question
What is the correct cell format to display the value "0.0412 %" , please? Regards --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09/04/2004 Hi Stuart try the custom format 0.0000 % -- Regards Frank Kabel Frankfurt, Germany Stuart wrote: > What is the correct cell format to display the value > "0.0412 %" , please? > > Regards > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http...

Is there a simple procedure to set my macros in Excel 2003 to be .
I have tried to create a digital signature as instructed in Help. I created it, but it is not in a trusted zone or something like that. How can I set Excel 2003 so that I am free to create and use macros? Shelley I assume you created the certificate/signature using the SelfCert tool in Office. Also, your Macro Security is set to "medium". With your workbook containing macros open, hit ALT + F11 to get to Visual Basic Editor. Select your workbook/project and Tools>Digital Signature>Choose. Pick the certificate you created and OK your way out. Save the workbook and clo...

OWA 2003 questions
Hi Before i was using Exchange 2000, since I've made the upgrade to Exchange 2003 when I go to the OWA 2003 web site I have this message after my credentials has been entered. This page contains both secure and non-secure items. Do you want to display the non secure items. After that message the padlock at the bottom of the screen disapears. This is not seems good to me When I was on Exchange 2000 I didn't have this message Thanks Are you using OWA with our without SSL? If you are trying to use it with SSL you will need to have a certificate authority setup in your doma...

Lookup question #4
I have a large spreadsheet which is not a table or database (lot of blank lines). As an example of my problem, in row 500, column F I may have a formula such as =F200. In column C of row 500 I would like to pull the data from column A of row 200. I need the formula in C500 to recognize the reference from F500 and pull the associated info from column A. ...

removed child breaks a for loop
in the following code For Each child In nodeFarm.ChildNodes For Each oAttribute In child.Attributes If oAttribute.Name = "LastUpdated" Then lastUpdate = oAttribute End If Next If DateDiff(DateInterval.Day, Date.Parse(Today), Date.Parse(lastUpdate.Value)) < 0 Then parentnode = child.ParentNode parentnode.RemoveChild(child) End If End If Next whenever a child is removed the loop stops and...

Hosted CRM question
I have a question about email and hosting. Will this situation work without any problems? The client has their own Exchange server for their email at their office. We are going to host the CRM application at our office. Will the client Exchange connector be able to transfer "tracked" email to the CRM server without any problem? Aalso, I would assume that there is not any problem with the client's Outlook client being able to access the hosted CRM application. Correct? Thanks, -Rick ...

Loop/Repeat Code
A2007 I need to run code while the record is displayed on a form, and must run this for all records. I have on the Click event of a button on the form: DoCmd.GoToRecord , "", acFirst Call MyFunction It is MyFunction I need help with: DoCmd 'Run some code and queries' DoCmd.GoToRecord , "", acNext Need help here to repeat/loop until the last record. Thanks in advance. ...

Simple Question
Hi all, I am completely new to Access and trying to learn it through my simple Investment management data. There will be tons of questions to be followed as I start developing my skills and I sure I am in right place to learn from this site. I have book Access 2007 Inside Out and I find it extremely useful, but sometimes a direct question in the group can help faster than surfing through the pages. I have following two tables - one to indicate securities I deal with and other for trades - Table Name : tblSecurities Market: Text Security:Text Description: Text Ta...

Migration question...
Hell-o all, I am testing a windows 2003 server running exchange 2003. In production, we are still on exchange 5.5. My question is this; If I put this test server with exchange 2003 in our production network, can I migrate the exchange 5.5 user accounts to the exchange 2003 server without harming the exchange 5.5 server? Or will the accounts be gone on the 5.5 box after migration? Any advise or thoughts are greatly welcome.. Gary As a matter of fact, you MUST go to AD before deploying Exchange 2003. Exchange 2003 does not have its own directory as Exchange 5.5 did. So you MUST be on AD be...

email forwarding question
Hello, I have a user with 2 email addresses. I want one of the addresses to be directed to our exchange 2003 server and the second to be forwarded to an external email address (hotmail for example). How do I achieve that? thank you in advance. You can setup a forward by right clicking on a user in active directory, and adding the forward under Delivery Options, on the Exchange General tab. As far as having 1 address forward, and the other not- I would just setup 2 different users... >-----Original Message----- >Hello, > > >I have a user with 2 email addresses. I want ...

Userform combobox question
Hello I have a userform combobox which is linked to the values in column A I want to find a way in VBA so that when an item is selected from the drop down menu, it returns the value generated by the formula in the adjacent cell in column B So in example below, if I select joe, I want the value 45 put somewhere I can use it as the input for the next vba variable. john 25 joe 45 carol 65 Anyone got any ideas? Many thanks TP You can try this. It might need some tweaking, but this is the general gist of it. "teepee" wrote: > > Hello &...

Socket Question.
We have a vb.net 2005 console application running that listens for data from about 100 wireless devices and receives and sends data back and forth from sql 2005. It works pretty well but every once in awhile it seems like it hangs and have restart the socket program itself to get going again. Looking for a way maybe when it doesn't receive data for specific time period, it restarts. Started looking at the receivetimeout option but can't find too much help on it yet. Thanks, Joe "Joe J" <Joe J@discussions.microsoft.com> wrote in message news:21E95AB8-...

Email Signature Font Question
I normally compose emails in HTML format. I want to use a font that is more like handwriting for some of my email signatures (such as Monotype Corsiva Italics, Lucida Handwriting Bold or even a non-true type font like Script). Do the recipients also need to have the same font installed on their systems to properly view my signature font? Or, by simply using an HTML format, would the font display properly regardless of what fonts the recipients have installed on their systems (presuming that they also use HTML on their end)? If not, what would be a common handwriting font that most Win98,...

Using the Question Mark With COUNTIF
Excel 2007 I have a small table that shows me the status of each item on the list. The status can be "Y", "N", "NA", or "?". I am using the COUNTIF function to tell me how many of each status is on the list. For items with a status of "?", which denotes an unknown status, I simply take the total number of items on the list and subtract the sum of the other status values to arrive at a count of items with an unknown status. This works fine. However, I am curious as to whether or not the "?" can be used with COUNTIF....

Outlook 2003 cached mode question
We have an external office set up using Outlook 2003 in cached mode. User A manages User B's calendar using the calendar located on the Exchange server. User B has a laptop with the Outlook 2003 cached mode enabled. If User A makes a change to a meeting on the Exchange copy of User B's calendar, will that replicate down to User B's cached Exchange copy...or will User B's cached copy overwrite the changes User A just made? the new copy will replicate down. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (V...

Oops already got my question answered
Sorry, I reread Brian Tillman's post from before and realized he had already answered my question. Using View- Bcc Field brings it up on the tool bar and I can paste away. Thanks again! ...

Mapping Question 02-04-05
I have added a new memo field to the quotedetail schema (display name productdescriptiondetail) and added the new field to the quote products form. I would like the standard product description memo field (schema display name description) within the products form to populate this new field whenever an existing product is added to the quote. I added a map under quote\quotedetail that is source attribute (description) to destination attribute (productdescriptiondetail). I published the schema and did an IISRESET. When I add an existing product that has data within the description memo field,...