Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Continuous Loop


I'm having problems with my code - I'm stuck in a continuous loop.

My code is:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Do Until ActiveCell = ""
If ActiveCell = "Completed" Then
ActiveCell.Offset(0, -1).Range("a1").Select
Selection.Font.ColorIndex = 1 'Black
End If
ActiveCell.Offset(1, 0).Range("a1").Select
End Sub

I'm trying to see if "Completed" is in column B and if it is, turn the corresponding row in column A black. I think my problem has something to do with placing ActiveCell.Offset(0, -1).Range("a1").Select within my If statement. When I remove that line the code works, to some extent, in that it turns the word "Completed" black but not the date - it also doesn't allow me to enter anything else in column A as it continually runs when I click in any cell - is this to do with Worksheet_SelectionChange?

As I'm sure you're aware I'm new to VBA and need all the help I can get!



View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Continuous Loop
How do I get out of a continuous loop?


Continuous Monitoring From VB
I have a VB app, which needs to monitor a variable which is supplied from outside of VB. This variable is constantly changing and will need to be monitored every second at the maximum. Im not sure how to do this. I have done it before using the Ontime function but that was a daily cycle. This is about a second. I suppose i could do it with loops but i dont want to lag the cpu. I have a basic grasp of vb so go easy.


Problem With Continuous DOS
I have a program that needs to be executed in DOS. While this program is running I need to check for errors etc, so its not only one DOS command to which Im expecting one reply, but continuos status in DOS command. I have downloaded a program for handling DOS input/output, the problem is that it freezes if its not a single command an single reply, for instance netstat works very well but ping -t would complete freeze my whole comuter. is there a way to handle a ping -t command? Since the program i need to run in DOS would follow the same continuous principle.

Vb6 Continuous Forms
How can I create a continuous form in Visual Basic 6 with out using the msdatrep.ocx

Continuous Forms
I have a continuous form.That picks up data (a single field) from a query .So I have something like a continuous form looking like a combo/list box on my interface.If you select a field in the continuous form,I would like to see it highlighted or maybe turning bold.Now If i write the code ,all the fields are turning bold .I would like to make it work such that only the record I click on should be highlighted or should become bold?

Continuous Printing
In my application I have an option to print tickets. I want to know how I can make the ticket scroll to next ticket in the printer. I tried a lot but after one printing the next ticket gets printed on the perforation of the ticket.

I want that the user simply sits back, while all the tickets are automatically printed.

Continuous While Statement
Sorry, I'm used to JavaScript here, but I'd like to know how to make a while statement that constantly loops (until the program is closed). Thanks in advance.

How Do I Use Continuous Scroll?
i have a MDIForm that displays another form on it. i have scrolling on but when i drag the box to the edge of the screen i want the scroll bars to move as long as i hold the box at the edge of the MDIform like in MS Excel. how do i do that?

Continuous Focus
i have a video project , and i stays in the corner of my screen. but when i open somthing else it goes behind that application. so how would i keep this ontop of everything while i'm working.

Continuous Forms?
Is there a way to mimic the "Continuous Forms" option of Access in a VB6 form?

Next Continuous Record
my case

ID1 user1
ID2 user2
ID4 user4
ID7 user7

is it possible to add continued record (for example ID3, ID5,ID6...) like new records

Continuous If Then Statement
Is this possible? I can do something like this in crystal reports, by just ending each if then with a ;

How do you do it in vb?

If grid1.TextMatrix(i, 5) = "001" Then
intBreak = 0
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
If grid1.TextMatrix(i, 5) = "002" Then
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
If grid1.TextMatrix(i, 5) = "003" Then
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
If grid1.TextMatrix(i, 5) = "004" Then
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
If grid1.TextMatrix(i, 5) = "005" Then
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
If grid1.TextMatrix(i, 5) = "006" Then
intBreak = intBreak + grid1.TextMatrix(i + 1, 6) - grid1.TextMatrix(i, 7)
End If

Continuous MouseDown
I've got a two buttons, one representing an "Up" arrow and one representing a "Down" arrow. Next to this is a textbox. I want to have the ability that when you click and hold the Up arrow, the number in the textbox will keep incrementing by one the whole time the button is held down, then when the user releases the button it will stop.

Currently, everything I've tried has failed. The MouseDown event appears to only fire once even if it's being held down.

Continuous Equation
Hey, I'm back in search of some more help! haha

Here's my situation. I have a program made that will take in information From an RFID reader through MSCOMM. Every time a RFID tag is scanned, the information from the card will be matched up to a "case" using Select Case. It will then output a price (specific to that case) to a text box.

What I want to do next is have that price go into an equation (X = X + Price).
I also initialize X = 0.

My problem is that when i scan a new card X ends up becoming equal to price, and not adding on to the previous value of X. I'm pretty sure that i need a Do Until loop so that it will continue to add to the previous value of X. But when I try using a while loop my program freezes up. Any suggestions?

Private Sub cmdRun_Click()
Dim Total As Currency
Dim Item As Currency
Total = 0

Select Case SomeString

Case "19C739F070000CC"
Text2.Text = "$6.26"
Item = 6.26

Case "19CAFDEF700001A"
Text2.Text = "$1.67"
Item = 1.67

Case "19CF4FCEF70000E5"
Item = 9999

Case Else
End Select

Do Until Item = 9999
Total = Total + Item

Continuous Forms?
Hi, In MSAccess you can use a feature to display data as a 'Continuous Form'.

So if, for example, a company has three addresses you can show the first address with each line of the address in separate text boxes. And then the second address appears below again in text boxes. And the third address etc.

Can you do this in VB? I don't want to use some sort of data grid.


Continuous Form In VB?
In Access I can use a Continuous Form to load all data from a table.
And it's very easy to use.

But how do I do this in VB as simple as I did in MS Access?
I also wanna be able to update every recordset who is in the form.

Continuous Time
Please help. What is the code for displaying continous time in a lblTime.Caption label? I can get the time to show when I start the project, but it does not keep the current time.

Continuous Forms
Hi - I was hoping someone might be able to tell if I can replicate the Continuous Forms look from msAccess in a VB 6 form.

Any standard MS Controls that I can see (ie. MSFlexGrid) wont let me have multiple fields in multiple rows..


Continuous Operation
I've got a program I'm creating that polls industrial units through the serial port. These units must be polled continuously at the quickest rate possible, and must run endlessly. So I have two questions:

1. How can I create a really small, small delay (about 10 ms)? The VB timer only allows me to have delays accurate to approx 70 ms.

2. How can I have my program run continuously without running out of stack memory. The way it is now, once started, it calls a sub which calls another sub which calls the first sub again. I don't know how else to make it run endlessly, but the stack fills up so quickly!

Any ideas? Any help would be appreciated.

Continuous Forms
I created a program for my company using Microsoft Access VBA. I am currently trying to move over to VB using Visual Studio 2008. I am trying to make as few visual changes as possible and one of my forms is setup as a continous form listing all our current customers with buttoms to the right of the company name to execute certain forms and such. I can not seem to find a way to do a simular setup in Visual Studio 2008. Any Ideas?

Continuous Data

In MS Access, I used continous form and place the button, if the user hit the button, it will give out popup form for viewing more details of specific record info.

In Visual Basic 2005,
I used datagrid control / other controls to retrieve data from SQL Server. But, I just put 2 fields columns data, and then I want to let the user click on data to show more details of that record (similar to the website link). Do we have option for doing that?

Continuous Form.
Hi Everyone,
I am creating a data entry front end using VB6 on SQL Server Database. This
is what I need. I have created some TMP tables for this. This program was
set up like this in Access and I am trying to keep it somewhat close to the
Access program. There are several stages that I need to go through to
complete this task. The first thing that needs to be done is to Purge all
the TMP tables. Then when the form loads it needs to give me a listing of
items such as software version and the user needs to see all information on
one form to be able to select the appropriate version. I have set it up with
a text box and a check box. The user also needs to be able to select more
than one option before going to next form were there is more information. I
guess what I need is the ability to create a continuous form. Is this

Thanks in advance

Jay Rye
QA Testing Specialist
Galagher Financial Systems, Inc

Continuous Entry
continuous entry ...?

Continuous Execution?
I wrote a program that I need to continuously run in the background, even if it loses windows focus. How would I force it to continue to execute the code even when Im looking at another window?

Continuous Form
I'm using MsAccess form and I have created continuous form and I want to do the same thing in VB 6.0. How can I do that? Maybe a grid or something else?

Michael Sakellis

Continuous Frm And Controls
I have a continuous form that lists records with dates. I want each week to be a different color. In the Current event I am capturing the value of the control and sending it to a procedure that assigns a color to that record. However, it only uses the 1st record (or current record) because it is a continuous form and the code is in the current procedure. Using recordsets would be great because then it could move through all of my records, however, I can't capture a recordset value and send it to a control (Can I?). My procedure is setting the control forecolor property. I apologize if this is confusing, but any help would be greatly appreciated.

Thank you,

Images In Continuous Form?
I have a Access 2000 DB which I use to store images and I am trying to make a continuous form to show all the images and titles etc. The porblem is when I change the picture for an image control - all the images on the form change. Anyone know a way to get different images to show up in a continuous form?

Also if the image is stored in a binary blob - does anyone know a way to display it without writing a temp file?

Continuous Behaves Like Single
I have a pretty complicated Access form with the "Continuous Forms" set to display multiple records per screen. It occasionally starts acting like a "Single Form" even though the setting is continuous, not single.

The only solution I've found is to start again from a backup and redo my recent work. Any ideas?

It is the F_SubmissionUpdate form in the attachment.
You have to
open the F_User form,
then change user to "Homer Roderick"
then open the F_SubmissionUpdate form,
then select "All Submissions" from the "Main Filter" combo box on bottom left.
This will show 2 rows, but only one at a have to scroll to see more

Access To VB And 'continuous Forms' -new To VB
We are in the process of re-writing some old Access 2000 databases with VB 6. One of the Access forms we're re-writing is a continuous form (displays all records on a form instead of just one). How can we use 'continuous forms' with VB? thanks much

Continuous Forms In Access
HI, I'm new here. Sorry if it's considered a breach of netiquette here to ask a question on your first post, but here goes.

I've got a 'continuous' form (with header and footer) embedded as one of several subforms in a main form. I have several buttons on this continuous form, which are repeated for every record (hence the continuous bit).

When one of the buttons is pushed, I want to set the 'enabled' attribute of the other to false so that the user isn't fooled into thinking he still has that choice.
The problem is that when I set the control's 'enabled' property to false, ALL the continuous form's buttons of the same name are greyed out!

Actually it's not the button that will disable the other button - they both open forms themselves and when the user commits to a choice on these forms (a big OK button) the opposite button (eg not the one the user clicked to open the form he's seeing) is disabled. Phew. Just thought I'd explain that so nobody asked why I didn't just use a combo/list/check box.

Is there any way around this?

Thanks for any info you can give


Continuous Beep Program
I'm using the Beep function in kernel32.

Public Declare Function Beep Lib "kernel32" _
(ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

I use the code Beep 1000, 1000

But the problem is I want the beep to be continuous until a command button is pressed and the beep stops. How do I use the beep function to do this?

Create Continuous Plot

How can I create a continuous plot from, say, a text box input? I am writing a simple DAQ code for a system and I would like to display the sampled data on the screen at a given rate. I could be using a timer event or the sampling done signal from the connector.

Does anyone have any ideas? I am sure this has been done before but I couldnt find it yet.


Printing On Continuous Stationery
Is there a way in VB6, to format the data sent to a printer?

I need to print out my report on continuous stationery, with predefined columns and text positions.

How do I do this?

Continuous Repeating Of Wav Sound
I made a graphic animation of a telephone and a handset. The hand set is moving up and down. I added a telephone wav sound to the form through an ole object so that each time the form loads the telephone rings but I need the telephone wav sound to keep repeating itself until I stop the program manually, right now it only rings once.

In an mp3 file I have and option to play a song continously but I don't see a property or option to do this with my wav file. I want the wav sound to repeat over and over until I stop the program

What do I do to achieve that.

My code in the form is ole1.action=7 (which causes the sound to be played when the form is loaded.

Continuous Scrolling Graph
I'm trying to create a continuous scrolling graph. I'm reading in data, ploting it on a picture box, and scrolling the picture box as the data reaches the right edge. After all the data is taken, I want to be able to scroll the graph back to the beginning (and to points inbetween). Using BitBlt copies over the old lines. If I use 2 Picture Boxes, one inside the other, then the old lines get erased as they move past the edge of the other box. Is there a way to make a scrolling graph and preserve the early lines?

Printing In A Continuous Form
Anyone who knows how to print in a continuous form using vb? I'm feeding the paper on the tractor and i'm using Epson LX-300. Even though i'm using a continuous form the printer stops printing when it reaches its bond paper size and if the printer continuous printing the printer will eject certain amount of paper before printing again, resulting in that the data are now misaligned with the labels in the form.

Please help.

Anything In VB Like The Continuous Form In Access?
I have found the datagrid control is similar to the datasheet view in access but i havent been able to find anything similar to the continuous forms, is there anything similiar to it? tia

Continuous Form Fill-ins
I'm migrating to Access XP. I have created VB continuous forms in previous versions and not had this problem....any insight. The form searches a table and fills in several fields based on what is in my table. Works great for the first record, however, when I search the table for next record on continuous form, the first record is updated with the pull through from the second record?!? My previous deliminator (ME!) no longer works. What's a girl to do? Thanks

Using A Listbox In A Continuous Form
I have been troubling over this for a few days, and I know there must be a simple answer to it, but as always it is not presenting itself to me.

I have a Continuous form with a text Box and a list box, all that I want to do is list the items, from a reference table, based on what is in the text box.

This works for the first record, but that is all that the listbox will do. for the other records, the listbox will just list what is related to the first record.

I inserted the code I used below:-

Private Sub Form_Load()
Dim sSQL As String
Dim Irid As Integer
Irid = [Forms]![Form1]![Text0]

        " WHERE TEST.RANGE_ID=" & Irid
   List2.RowSource = sSQL
            If sSQL = "" Then
        List2 = ""
            End If
End Sub

Using A Listbox In A Continuous Form
I have been troubling over this for a few days, and I know there must be a simple answer to it, but as always it is not presenting itself to me.

I have a Continuous form with a text Box and a list box, all that I want to do is list the items, from a reference table, based on what is in the text box.

This works for the first record, but that is all that the listbox will do. for the other records, the listbox will just list what is related to the first record.

I have attched a sample Db with a form in to explain a little better (sorry couldn't attach Db)(code in post above)

Edited by - karmann kenny on 6/9/2003 6:14:32 AM

Keeping A Count On A Continuous Form
Suppose I have a continuous form listing an individuals dependents / people that live with them. I already know their birthday and their age. Now I want to assign a number ONLY to those whose age is < 13. The first instance of this will be numbered 1, the second will be numbered 2, etc.

I was using .CurrentRecord to do this, but there's no guarantee that the records that meet the age criteria will be sequential. Age isn't actually in the DB either, its calculated based on the BirthDate in the DB and the System Date. (i.e. record1 is 14 and doesn't qualify, but record 2 is 12 and does. Record 3 doesn't qualify, but record 4 does. Record 2 should be given the number 1, and record 4 should be number 2. Record 1 and 3 should have no number associated with them).

How do I keep a running count on a continuous form, and have that count reset when I move to a different master record (a different individual with different dependents)?

Working Programatically With Continuous Forms
I've got an Access Project with a couple continous forms (for those one-to-many relationships), and I need to calculate a few things.

For example, each child record has a birthdate. I need to take the birthdate and calculate the age, and put it in a textbox.

How do I, on the Birthdate_LostFocus event, tell it to calculate the age of the appropriate record on the form (say, the third record). I assume that somewhere, behind the scenes, there is a control array representing each line on the form.

Does anyone have any experience working with continous forms this way?

Continuous Running Powerpoint Presentation
I am using VB trying to run some PP presentation continuously.
I find that they run ok.
But show is interrupted by Pres. opening in edit mode.
Is there any way.
I can run one - then load another etc without entering edit mode and stopping the display. I have done a lot of reading, including the helpful tute on the forum, but can't find the answer.

Thanks for any ideas.

Set PS = PP.Presentations.Open(FileName:=Sfile, ReadOnly:=msoFalse, WithWindow:=False)
PP.Visible = True
With PS.SlideShowSettings
.AdvanceMode = ppSlideShowUseSlideTimings
end with

Writing An Array To A Non-continuous Range
Iíve got a Range with a known number of cells, all from the same row. But I donít know the order of the columns. I build up the Range based on the Row and Columns similar to this :

I also have an array with as many elements as there are cells in the range. What I want to do is to simply set range=array, so that I get one array element in each cell. However, since the range is not continuous, all cells get the first element of the array.
I donít want to loop through the range and array and write to the sheet for every loop as this is very slow.

'Start simple initialize
Dim column1, column2, column3, column4 As Integer
Dim cell1, cell2, cell3, cell4 as String
Dim row1 As Integer
Dim simpleArray(1 To 1, 1 To 4) As String

column1 = 1
column2 = 3
column3 = 4
column4 = 2
row1 = 10

cell1 = Chr(column1 + 64) & row1 'yileds e.g. A10
cell2 = Chr(column2 + 64) & row1 'yileds e.g. C10
cell3 = Chr(column3 + 64) & row1 'yileds e.g. D10
cell4 = Chr(column4 + 64) & row1 'yileds e.g. B10

simpleArray(1, 1) = "a"
simpleArray(1, 2) = "b"
simpleArray(1, 3) = "c"
simpleArray(1, 4) = "d"
'End simple initialize

Dim myRange As Range
Set myRange = Sheets(1).Range(cell1 & "," & cell2 & "," & cell3 & "," & cell4)
'the range is now "A10; C10; D10; B10"
myRange = simpleArray

The problem is that the range looks like "A10; C10; D10; B10", and it need to be ďA1010Ē

Any ideas anyone?

I have thought of making an array out of the cells in the range, and sort it. Are there any sort functions for arrays or do I need to make (or find) a custom made one (guess there are some in this forum).

Any other ideas anyone?

Problem Printing On Lx 300 With Continuous Paper
Hello, ž'm tying to made a program in vb6 and an epson lx300 printer with continuos paper.
When i try to print a secuence of 5 or 6 lines of text (some kind of ticket) to the printer whit printer.print metod and finalizing them with printer.enddoc. The printer prints ok but the paper go out too long, how can i stop de paper for cut them at bottom of text?
I try with printer.papersize but i don't have any change
Please helpme.

Simple Continuous Form Issue---
I have a form that I'm using in Continuous Form View to display fields of an Inventory Table. The problem I have is using code to set the value of one field by multiplying others.

For example, I have the fields "Cost", "Retail" and "Margin". I calculate the "Margin" by the function:

Private Sub Retail_AfterUpdate()
Me![Margin] = Me![Cost] / Me![Retail]
End Sub

After updating the "Retail" field, it does a good job of calculating the margin for that product, but the problem is that since the form is in "Continuous Form View", it changes the margins for EVERY product shown on the page to the same margin for just the product selected.

Would there be a function that I could use to simply change the data in the field of the current record that is selected?

Thank you in advance for the help, I'm sure there is a way to do this but since I'm still learning...I'm here asking for help!!

DataReport Printing On Continuous Paper
hey, guys.

i'm still learning the ins and outs of data reports, and here's my problem:

after displaying data in a listview, i'll be using data report for printing. however, i don't know how to set the program up so that it prints ok on continuous paper (the kind dot matrix printers feed on, with the holes in the sides). from the datareport preview, it looks to me like it's normally set up for printing on 8.5" x 11" paper.

is there a way to set it up so that the program automatically prints data on continuous paper, without fiddling with the printer? could anyone show me some sample code for that?

i tried searching this site for tips on that, but so far i've come up blank. any help would be appreciated.

thanks a lot.

Continuous Text File Writing
Hey guys, lets say I have this code:

Dim i As Integer
Private Sub Form_Load()
i = 0
End Sub

Private Sub Command1_Click()
i = i + 1
Open "C:Test.txt" For Output as #1
Print #1, i
Close #1
End Sub

What Output/Print does is it overwrites the file with "i". So if I equaled 1, I pressed command1, it would write 1 in the text file. If I pressed it again, it would delete 1 and write 2.

What my question is, what is the way to make it so it keeps the 1, and writes the 2 right next to it along with every other time I click it, it will just continue the writing?

Flexgrid Select Non-continuous Rows???
Anyone know if/how you can select non-continuous rows in an MSFlexGrid?

For example, I'm listing a buch of stuff, but I want the user to be able to select rows that are not in order. Like amultiple select in a listbox. (perhaps using the <ctrl> key)?


Copyright © 2005-08, All rights reserved