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




Finding A Time Inside A Time Range


i use a timer to tell the server when to start sending me time. 'theoretically' it is supposed to start on-time and look like this

11:22:54 - 11:22:49
11:22:59 - 11:22:54
11:23:04 - 11:22:59
11:23:09 - 11:23:04

etc

where i compare the current time on the left (what just came in) with the time on the right (the time stamp just prior)

but sometimes the server 'hiccups' and i might see this instead


11:22:57 - 11:22:49
11:23:02 - 11:22:57
11:23:08 - 11:22:02
11:23:12 - 11:23:08

or something like that

the server is geared to send out a time stamp every 5 seconds (its minimum) but i need to make a change at :59

basically i need to evaluate the current time stamp and the one just prior and see if my :59 is somewhere either in between or at either end (where it 'usually' but not always is)

something like

"if somewhere in between the current time and the last time a time with :59 seconds can be found

dostuff

end if"




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Finding A Style Inside A Range
OK, this one should not be hard but It's driving me up the wall...I have NO idea what I am doing wrong here. yes, I have searched the forum and yes, I have looked into the word 101 sticky thread... I think I understand the function but for some odd reason it is still not working.

This function checks if a paragraph has any characters that have the Style of "SomeStyle". And returns a msgbox with the result of the search. I've kept it as simple as possible since I want to know and understand how this stuff works


Code:
Sub test()
Dim test As Paragraph

' For each paragraph in the document
For Each test In ActiveDocument.Paragraphs

With test.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Style = ActiveDocument.Styles("SomeStyle")
.Text = ""
End With

test.Range.Find.Execute
MsgBox test.Range.Find.Found


Next test

End Sub

What on earth is wrong in this function?? If I include a paragraph that holds the style "SomeStyle", it still doesn't find it...Not if the whole paragraph has the whole style, or just a part of the paragraph...

Finding A Number In A Range Inside Text
i am parsing some text. the text has words and numbers. i want to find the first instance of a number between 999 and 10000

for example

ipos = instr(1, text, number between 999 and 10000)

i am trying to find out how to properly state "number between 999 and 10000" in the above instr code.

for example, the text says:

"i bought 4001 eggs"

my instr would find 4001, and the position would show 10

Add Controls Inside A Picture Box At Run Time
All,

Would anyone be so kind as to point me in the direction of a tutorial that addresses adding controls within a picturebox at run-time? Or provide some quick sample code?

What I have/want to do:

1) I have a picturebox which holds 15 rows of design-time created labels and textboxes, each a control array. The picturebox also has a scrollbar on the side.

2) On Form_Load, application runs a SQL query against the Access database based on the username the user logged in with. If it returns greater than 15 records, then take (number returned - 15 = #) and create # of additional rows inside the picture box, which will be viewable by dragging the scroll bar.

I know how to create controls on the form at run-time, I just don't know how to do it within the picturebox. Any help is greatly appreciated.

Time Range Help
hi,

does anyone know how to specify a time range and then compare it against the current time?

Like:

range = 8:00 am to 9:00 am
is the current time between the above range?

thanks in advance,

aaron

Time Range
How can I do to get data successfully from this query (made by ADO):

SELECT * FROM DATA WHERE TIME_CONTROL >= TimeValue('06:00:00 PM') AND TIME_CONTROL <= TimeValue('06:00:00 AM')

In other words: get rows from table DATA and its rows match condition: field TIME_CONTROL is BETWEEN 6 pm and 6 am (all night)

Thanks.

Time Range
Hi all,

How do I set the time range and tell VB to check if it's in the time range then do sth else sleep until it reach the time range then execute the command  ?  Thanks a bunch.



Adding Controls At Run-time Inside A Picture Box
Ok... Here's the deal. I have to add controls on the fly inside a picture box. They are actually line items for a pseudo-returns system. Based on the amount of line items I need to create specific array of controls for each line item. Each line item contains 3 labels, 2 text boxes, 2 combo boxs and one check box.

How is this easily completed? Please Help!

Positioning Images Inside Arrays At Run Time
Hi all , I'd really like to come up with a loop for this one but havent been able to so far. The image arrays are created at run time in rows of 6 items horizontally and to a maximum of 600 rows vertically. My problem is that I have to provide for that maximum of 600 rows if or when needed and surely would like to avoid the hundred lines of code that I would have to insert in there to complet it. I've got my first index hidden and positioned just right so that only the actual arrays created are visible.

Any help or comment would be appreciated, thanks

'Sample code

VB Code:
Option ExplicitPrivate PX As Long Private sub PixFound()PX = PX + 1 Select Case PX Case Is < 7  'load first row of images (horizontally)     loadHorz     Exit Sub   Case Is = 7 ' start second row down     loadVert  Case Is < 13 'load rest of second row     loadHorz     Exit Sub   Case Is = 13 ' start third row down     loadVert  Case Is < 19  'load rest of third row     loadHorz     Exit Sub 'ETC,ETC up to 600 maximum End SelectEnd Sub Private Sub loadHorz() Load Image2(PX)  ' Create a new control.          Image1(PX).Top = Image1(PX - 1).Top          Image1(PX).Left = Image1(PX - 1).Left + Image1(PX - 1).Width 'Set new control to the right of previous          Image1(PX).Visible = True          Image1(PX).Stretch = True          Image1(PX).BorderStyle = 1          Set Image2(PX).Picture = LoadPicture(File1.path & "" & File1.List(X))End Sub Private Sub loadVert() Load Image1(PX)  ' Create a new control vetically.          Image1(PX).Top = Image1(PX - 1).Top + Image1(PX - 1).Height 'Set new control to bottom of previous            Image1(PX).Left = Image1(PX - 1).Width           Image1(PX).Visible = True          Image1(PX).Stretch = True          Image1(PX).BorderStyle = 1          Set Image1(PX).Picture = LoadPicture(File1.path & "" & File1.List(X)) End Sub

Time Range Problem
Hello guys!

I have a problem with my vba script. I have the following
data in excel worksheet. For example

Name1 05:00 18:41
Name2 05:11 13:25
Name3 14.00 23.15
etc.

And I have 3 time ranges:
1) 06:00-18:00 daytime
2) 18:00-23:00 eveningtime
3) 23:00-06:00 nighttime

How could I add behind every name the hours
which he has worked on Eveningtime and Nighttime?
The result should be:

Name1 05:00 18:41 0:41 01:00
Name2 05:11 13.25 0:00 00:49
Name3 14:00 23:15 5:00 00:15


Please help me,
Jessica

Help With Comparison Of Range Of Time
good day to all!

my problem is how to compare the below samples:

time1(01:00 PM - 03:00 PM)
time2(02:00 PM - 03:00 PM)

im confused on how to compare those..
i mean if time 2 is in time 1's range then that is an error..

can someone help me with these?

thanks a lot!

Parsing A Time Range
Hey guys, VB isn't my language and so I'm a little lost here, but perhaps this is easy for someone and you can help me out.

I'm building a little macro for a excel spreadsheet and I want it to parse a string and tell me the number of hourse

ie
"9-5p" (9 to 5 pm) would become 8
"9a-5p" (same as above) would become 8
"9am-5pm" = 8
"9-5pm" = 8

so on and so forth. only a given set of charcter woudl be specified of course. like a,am,-,p,pm
thanks for your help

Determining TIME Range In VB
I have a VB program that runs every 60 seconds. Between the hours of 3PM and
7AM (2nd and 3rd shift) it performs a special task...I am using the code
below to determine the time. Is this the right way to do it???



Const STARTTIME = "3:00:00 PM"
Const ENDTIME = "7:00:00 AM"
If Time >= STARTTIME And Time <= ENDTIME Then
...
...
...
End if

Out Of Range Date Time Value
hi all
when I try to insert data into table (including date) I get a message simmilar to this :
the conversion of char data type to datetime data type resulted in an out of range datetime value.
P.S: I`m using the DTPicker to choose date,,,
thanx a lot

How To Convert My GMT Time To U.S.Central Time And Daylight Saving Time
How to convert my GMT date and time to Central Standard and Daylight Saving Time.

For example I have GMT Time as:

02/29/2004 1:00:00 AM

I want as:
02/28/2004 8:00:00 PM

When I give date aswhich is falling under daylight saving time)
04/08/2004 1:00:00 AM

I want to get as 04/07/2004 9:00:00 PM

How to do that and how to determine wheather it is falling under daylight or standard time.
It should not do based on my Computer date and time though. If it is then it is going
to calculate everything based on daylight saving time because right now I'm under daylight
saving time.

I appreciate your help.

Thanks
VM

How Can I Add New Controls At Run Time And Make Them Inside A Container Picturebox?
I want to use a picturebox as a container for controls I add to my form on runtime using the Controls.Add method. The problem is that the controls are being created "behind" the picturebox (which is created on design time) instead of in it. How can I do do it so they are created inside the picturebox instead of being hidden behind it?

Create An Email, Works SOME Of The Time. See Code Inside
Code:
Private Function Email_Error(ByVal ToEmailAddresses As String, _
Optional CCEmailAddresses As String = "", _
Optional Subject As String = " ", _
Optional MessageBody As String = " ")
'When a run-time error occurs, this routine fires off an e-mail to the author

On Error GoTo ErrHandler

Const CONST_EMAIL_COMMAND = "MailTo:{ToEmailAddresses}&CC={CCEmailAddresses}&Subject={Subject}&Body={MessageBody}"

Dim rc As Variant
Dim sCommand As String

If ToEmailAddresses = "" Then
MsgBox "No e-mail address has been set up for the developer. Please enter this in the To: line of the e-mail."
End If
sCommand = "MailTo:" & ToEmailAddresses
If CCEmailAddresses <> "" Then sCommand = sCommand & "?CC=" & CCEmailAddresses
If Subject <> "" Then sCommand = sCommand & "?Subject=" & Subject
If MessageBody <> "" Then
'Ampersands, spaces, and line breaks need to be a special character in our 'mailto:' string
'NOTE: I could not find anything to handle [Tab] characters...so I just use five spaces to
'represent a [Tab] character. I know you can do better, though! ;-)
MessageBody = Replace(MessageBody, vbTab, Space(5))
MessageBody = Replace(MessageBody, " ", "%20")
MessageBody = Replace(MessageBody, "&", "%26")
MessageBody = Replace(MessageBody, vbCrLf, "%0D%0A")
sCommand = sCommand & "&Body=" & MessageBody
End If

rc = ShellExecute(GetDesktopWindow(), "Open", sCommand, "", App.path, 1)

ErrHandler:
If Err > 0 Then MsgBox Error$, , "Class CAppLog Function Email_Error()"

End Function



I didn't write the above code, but its purpose is to send an error report 2 myself when an error occurs. But it seems to work only SOME of the time. When it DOES work, an email pops up, populated with the information, and ready to send.

WHen it DOESNT work, nothing happens, no email pops up, no error prompt, nothing.

the only pattern i can see is that it always works at least the first time, and sometimes stops after that... and i have no idea why..

any help debugging or code changes would be great. thanks

Resizing Controls Inside An Ocx Control At Design Time
I do have controls like text box inside an ocx conrol which i m creating.I m not able to control the height and width property of the inside control(text box) in the design time when i m using this ocx control in applications.How do I change the width and height property of the inside controls on resize of the ocx control at design time.Please give me a soltion as fast as possible!!!

Finding Date (regardless Of Time)
hey guys,

OK: I have this search loop to find all DateTimestamps with a similar date (yyy-mm-dd) in a range. Eg :

from the dates

2006-04-03 09:14:25
2006-04-03 11:23:13
2006-04-03 13:11:41
2006-04-03 15:54:40
2006-04-04 14:43:09

with criteria "2006-04-03", the function should find all dates, exept the last one.

Code:
Dim DateStamp as string
DateStamp = "2006-04-03"
With RangeUsed
Set R = .Find(DateStamp, LookAt:=xlPart)
If Not R Is Nothing Then
Do
If R.Offset(0, ColumnOffset) = Comparison Then Counter = Counter + 1
Set R = .FindNext(R)
Loop While Not R Is Nothing
End If
End With

And I already knnow my problem, just not how to solve it.

This loop will return a maximum of one found result. This is because the cells containing the DateTimestamp in the RangeUsed is build like:

yyyy-mm-dd hh:mm:ss

So the .Find works (using a string and lookat:= xlPart ) but the Findnext is based upon the total content of the cell (yyyy-mm-dd hh:mm:ss). Obvisously not all the entries that are made for that day (2006-04-02) have the exact same time. My question: how can I use findnext properly, without having to throw away the time (since I need the time for another function)

TIA!

PS: I cant just loop through the cells since I have to check over 6000 entries for every day in the month, for different Comparison values (= huge CPU load)

Finding A Time In A SQL Statement
I have a VB program that works with an Access 2k back end. There is really only one table in the db. There is a 'date' field and a 'time' field, both of which are the date/time variable type. I will need to write an SQL statement to find records in between two times, but for right now I am just trying to get the format down. I have tried to get records that = 10AM.

myTime = timeValue ("10:00AM")
strSQL = "SELECT * from tblPhoneRecords WHERE callTime = '" & myTime & "'"

myTime is correct, but I am getting a datatype mismatch error when I run the thing. Does anyone have any ideas? Thanks!

Brian

Finding Creation Time?
Okay, I need to add a feature to my program so when I select a file from the FileListBox, it will show the Creation Time of the file in MsgBox. I was hoping I could get it to show the time the file was created by a standard EST clock, not by the persons time on their computer, because that can cause it to be inaccurate. Anyways, can someone explain to me how to find the creation time? And if possible, make it so it shows the actual EST time it was created?

Finding Total Time
I have two fields in a database with dates:

StartTime 5/2/01 8:42:07 AM
StopTime 5/2/01 8:45:24 AM

I have to find a way to figure out the total time so I can add it to a textbox.

Total time 2min 17sec
or
TotalTime 137sec

If anyone can help huge thanks in advance!!!!

Finding A Process's CPU Time
How would I go about finding the CPU time of a process?
Specifically the Idle Process.
I want to take the CPU time of the Idle process and divide it by the system uptime to get the CPU load percentage since boot.
I know how to get the system uptime using the GetTickCount API call, I just can't figure out how to get the CPU time of the Idle Process.

Run-time Selection Of A Range By User
Hi there,

I want to enable the user of my Exel VBA program to select a range ( most liekly by his mouse) when prompted to and then the flow return to the program. Anyone got any idea/hint? Thanks!

Run Time Error 9: Subscript Out Of Range
Hello..i'm going nuts. I've read thru most of the posts in this forum and tried lotsa ways but cant seem to get my code working.

What i'm trying to do is copy some info from one workbook to another workbook using VB6. I know its something really easy but I keep getting this error "Run time error 9: Subscript out of range"

Below is my code:

I tried a few variations..

Sub Combine()

Dim oExcel As Excel.Application

Set oExcel = New Excel.Application
oExcel.Visible = True ' <-- *** Optional ***

oExcel.ScreenUpdating = False
oExcel.Workbooks.Open FileName:="D:VB_ExcelBook1.xls"

oExcel.Workbooks("Book1").Sheets(1).Copy _
After:=oExcel.Workbooks("Book2").Sheets(1)
oExcel.Workbooks("Book1").Close

oExcel.ScreenUpdating = True

End Sub

I keep getting the error on the line below:

oExcel.Workbooks("Book1").Sheets(1).Copy _
After:=oExcel.Workbooks("Book2").Sheets(1)
oExcel.Workbooks("Book1").Close

I also tried:

oExcel.Workbooks("Book1.xls").Sheets("Sheet1").Range("A1:B4").Copy
oExcel.Workbooks("Book2.xls").Sheets("Sheet1").Paste _
Destination:=oExcel.Workbooks("Book2.xls").Sheets("Sheet1").Range("A1: B4")


Please help... thanks..

Run Time Error 9 - Subscript Out Of Range
Not sure what I'm doing wrong here, I've Dim User() as String and tried various ways to populate the array but getting nowhere

in the following code;

For i = 0 To 9
index = Combo1(i).ListIndex
If index <= 1 Then
index = 0
End If
CTemp = Combo1(i).List(index)
User(i) = CTemp
Next i

Each combo1(i).List(index) as valid data but the line User(i)=CTemp returns me the above error, any idea's where I'm going wrong

Many thanks

Subscript Out Of Range Run Time Error 9
Hi,
I am getting this error( Runtime Error 9 Subscript out of range) when i try to click on the button, I am using VB6.0 with SQL Server2000. I am giving the code over here, can any body help me to get out of this.. appreciate your help
Thanks

Public Sub cmdLvl2Click(ByVal aIndex As Integer, ByVal aiButton As Integer)

‘If the time Interval of the tmrCreateProcess
'timer is set that means the task is in the que and that the finction is
'called successively.
If frmmain.tmrCreateProcess.Interval Then Exit Sub
If aiButton = 2 And objNav.OperationMode = gctEditor Then
'condition added by RL for #10320
'If aIndex < objNav.TaskButtons.Count Then
objNav.CurrentButtonId = objNav.TaskButtons.Item(aIndex + 1).ButtonID
Set cobjFrmTaskOp = New cTaskOpDisplay
cobjFrmTaskOp.Parent = Parent
cobjFrmTaskOp.EditTaskop
If Not (cobjFrmTaskOp Is Nothing) Then
Set cobjFrmTaskOp = Nothing
End If
Call RefreshButtons
'End If
Else
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0 Then
'set the global g_objmaindisplay object,
'The object is used by the tmrCreateProcess control to execute the clicked
'task.
Set g_objmaindisplay = Me
g_index = aIndex
frmmain.tmrCreateProcess.Interval = 100
'ExecuteBtnTask (aIndex)
' the above code commented ,since the same is being
'done by the tmrCreateProcess control
End If
End If
Screen.MousePointer = vbNormal
End Sub




This is the code i am getting the error here:
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId

Run Time Error '9' Subscript Out Of Range
Help :P Can anyone Explain me why does this happen and how can i correct this?

Module

Code:
Option Explicit

Public Type CodigoPostal
CPID As Integer
CodPos As Integer
Arr As Integer
Local As String
End Type

Public sConn As String

Form


Code:
Option Explicit

Private MyConn As ADODB.Connection
Dim RecIndex As Integer
Dim CodPos() As CodigoPostal


Private Sub cmdIntroduz_Click()

Dim rs As New ADODB.Recordset, sql As String

sql = "SELECT NomeEmpresa, RamoActividade, Morada, Localidade," _
& "CodPostal, Telefone, Email, Site, ResponsavelInf, ResponsavelFor, Ncomp, Nempregados " _
& "FROM T_Ident"

'On Error Resume Next

MyConn.Open
rs.Open sql, MyConn, adOpenKeyset, adLockOptimistic, adCmdText
rs.AddNew
rs!NomeEmpresa = txtNomeEmpresa.Text
rs!RamoActividade = txtRamoActividade.Text
rs!Morada = txtMorada.Text
rs!Localidade = txtLocalidade.Text
rs!CodPostal = txtCodPostal(0).Text
rs!Telefone = txtTelefone.Text
rs!Email = txtEmail.Text
rs!Site = txtSite.Text
rs!ResponsavelInf = txtResponsavelInf.Text
rs!ResponsavelFor = txtResponsavelFor.Text
rs!NComp = txtNcomp.Text
rs!NEmpregados = txtNempregados.Text
rs.Update
MyConn.Close
Set rs = Nothing

End Sub

Private Sub cmdLimpar_Click()
Limpa
End Sub

Private Sub cmdSair_Click()
Unload Me
End
End Sub

Private Sub Form_Load()

Dim CP As New ADODB.Recordset, sqlCP As String
On Error Resume Next

RecIndex = 0
cmbCP.Text = ""
cmbArr.Text = ""
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "crm_verA.mdb" & ";Persist Security Info=False"
sqlCP = "SELECT ID, CodPostal, Arruamento, Localidade FROM T_CodPostal"
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = sConn
MyConn.Open
CP.Open sqlCP, MyConn, adOpenKeyset, adLockOptimistic, adCmdText
With CP
.MoveLast
If .RecordCount > 0 Then
RecIndex = .RecordCount
ReDim CodPos(RecIndex)
.MoveFirst
RecIndex = 0
While Not .EOF
CodPos(RecIndex).CPID = !ID
CodPos(RecIndex).CodPos = !CodPostal
CodPos(RecIndex).Arr = !Arruamento
CodPos(RecIndex).Local = !Localidade
cmbCP.AddItem !CodPostal
cmbArr.AddItem !Arruamento
.MoveNext
RecIndex = RecIndex + 1
Wend
End If
End With
MyConn.Close
Set CP = Nothing
End Sub

Private Sub cmbCP_Change()

Dim ctr As String

ctr = "entra"
RecIndex = 0
Do
[color=Orange] If cmbCP.Text = CStr(CodPos(RecIndex).CodPos) Then[/color]
txtLocalidade.Text = CodPos(RecIndex).Local
ctr = "sai"
End If
RecIndex = RecIndex + 1
Loop While ctr = "entra"
End Sub

The Error happens in the orange section

Thanks

Edit by mkoslof: Added line break in order to make viewing the post easier. Thanks

Run Time Error '9' SubScript Out Of Range
I am working with VB6. I am tring to increment a listbox record 1,2,3 ect. this is for a application that I tring to create. When it gets to the #7 record it gives the error message (Run Time Error '9' SubScript out of range)
Here is the code:
End If

Code:
TxtLastName_AfterUpdate.Value = ""
TxtSchoolName_Afte Wrestlers(wrestlerno, 1) = firstname
Wrestlers(wrestlerno, 2) = lastname
Wrestlers(wrestlerno, 2) = schoolname
Wrestlers(wrestlerno, 2) = wrestlerclass
If wrestlerno = 600 Then
Exit Sub
End If
txtWrestlerNo_AfterUpdate.Value = wrestlerno + 1
If wrestlerno(txtWrestlerNo_AfterUpdate.Value, 1) <> "" Then
Exit Sub
End If
TxtFirstName_AfterUpdate.Value = ""
rUpdate.Value = ""
TxtWrestlerClass_AfterUpdate.Value = ""
Exit Sub

Run-time Error '9' - Subscript Out Of Range
Hi, I get an error that says:

Run-time error '9'

Subscript out of range


The error hapends within a "for" loop. And the loop values are used.
Like:

***

For i = 1 to 100
For j = 1 to 100

if j = i + 2 then

end if

next
next

***

But that is not the actual code.

So why do this error happen?
How can I correct it?
How can I prevent if from happening again?

If you need more information about the error then just let me know.

thanks in advance

Julian

Run-time Error 9, Subscript Out Of Range
This is driving me crazy!

It seems like many of you have run into dll trouble before judging by the number of posts on the topic. So why should I be any different?

After using the P&W wizard and installing my application on a test win98 system, I received and error. Scanning the posts I realized I needed MDAC 2.5. So I installed that on my test pc and reinstalled the app. Now I'm receiving a run-time error 3706 when the app goes to access my Access 97 database. Again, looking through the forum I find where I may need to use Microsoft.Jet.OLEDB.4.0 instead of 3.5.1. Well, when I change my connections string(s) to 4.0 I now get the above mentioned Subscript out of range error. This is driving me mad, mad I tell you! Offending code below:


Code:
myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\Server6holdDYNATEX97_DYN_CPS.mdb"
myConn.Open

'Open the Recordset and load the DataGrid1
rsTemp.Open "SELECT * FROM tblTemp", myConn, adOpenKeyset, adLockOptimistic
Set DataGrid1.DataSource = rsTemp

'Format the columns of the datagrid to make them look pretty.
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(0).Visible = False
DataGrid1.Columns(1).Width = 1100
DataGrid1.Columns(1).Locked = True
DataGrid1.Columns(2).Width = 3500 'THIS IS THE LINE WITH THE ERROR
DataGrid1.Columns(2).Locked = True
DataGrid1.Columns(3).Width = 1000
DataGrid1.Columns(3).Locked = True
DataGrid1.Columns(3).NumberFormat = "$0.00"
DataGrid1.Columns(4).Width = 1000
DataGrid1.Columns(4).NumberFormat = "$0.00"
Your advice is much appreciated. Thanks!
braney

Subscript Out Of Range Run Time Error 9
Hi,
I already posted this issue couple of days back, I am trying to click on one button on the screen i am getting this Error, actually there are 16 buttons on the screen. Other button are works fine






VB Code:
Public Sub cmdLvl2Click(ByVal aIndex As Integer, ByVal aiButton As Integer)     'If the time Interval of the tmrCreateProcess    'timer is set that means the task is in the que and that the finction is    'called successively.    If frmmain.tmrCreateProcess.Interval Then Exit Sub    If aiButton = 2 And objNav.OperationMode = gctEditor Then                'If aIndex < objNav.TaskButtons.Count Then            objNav.CurrentButtonId = objNav.TaskButtons.Item(aIndex + 1).ButtonID            Set cobjFrmTaskOp = New cTaskOpDisplay            cobjFrmTaskOp.Parent = Parent            cobjFrmTaskOp.EditTaskop            If Not (cobjFrmTaskOp Is Nothing) Then                Set cobjFrmTaskOp = Nothing            End If            Call RefreshButtons        'End If    Else        If aiButton = 1 And objNav.OperationMode = gctNavigator And _                objNav.TaskButtons.Item(aIndex).TaskId <> 0 Then            'Ref-13518 :set the global g_objmaindisplay object,            'The object is used by the tmrCreateProcess control to execute the clicked            'task.            Set g_objmaindisplay = Me            g_index = aIndex            frmmain.tmrCreateProcess.Interval = 100            'ExecuteBtnTask (aIndex)            ' Ref-13518  the above code commented ,since the same is being            'done by the tmrCreateProcess control        End If    End If    Screen.MousePointer = vbNormalEnd Sub

I am getting the Error over here
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0 Then
Appreciate your help
Thanks

Subscript Out Of Range Run Time Error 9
Hi,
I am getting this error( Runtime Error 9 Subscript out of range) when i try to click on the button, I am using VB6.0 with SQL Server2000. I am giving the code over here, can any body help me to get out of this.. appreciate your help
Thanks

Public Sub cmdLvl2Click(ByVal aIndex As Integer, ByVal aiButton As Integer)

‘If the time Interval of the tmrCreateProcess
'timer is set that means the task is in the que and that the finction is
'called successively.
If frmmain.tmrCreateProcess.Interval Then Exit Sub
If aiButton = 2 And objNav.OperationMode = gctEditor Then
'condition added by RL for #10320
'If aIndex < objNav.TaskButtons.Count Then
objNav.CurrentButtonId = objNav.TaskButtons.Item(aIndex + 1).ButtonID
Set cobjFrmTaskOp = New cTaskOpDisplay
cobjFrmTaskOp.Parent = Parent
cobjFrmTaskOp.EditTaskop
If Not (cobjFrmTaskOp Is Nothing) Then
Set cobjFrmTaskOp = Nothing
End If
Call RefreshButtons
'End If
Else
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0 Then
'set the global g_objmaindisplay object,
'The object is used by the tmrCreateProcess control to execute the clicked
'task.
Set g_objmaindisplay = Me
g_index = aIndex
frmmain.tmrCreateProcess.Interval = 100
'ExecuteBtnTask (aIndex)
' the above code commented ,since the same is being
'done by the tmrCreateProcess control
End If
End If
Screen.MousePointer = vbNormal
End Sub




I am getting the error here:
If aiButton = 1 And objNav.OperationMode = gctNavigator And _
objNav.TaskButtons.Item(aIndex).TaskId <> 0

Run Time Error 381 - Subscript Out Of Range
For lngCount = 1 To UBound(arrPT1)

MSFlexGrid1.TextMatrix(lngCount, 0) = arrPT1(lngCount)

Next IngCount


I get this error when I try to run....

Run Time Error 381 - Subscript out of range

Anyone have any ideas?

Run-time Error '9' Subscript Out Of Range
Hi Experts!

I've made a small application using Access 2000 db, packed it and installed it on my personal pc. For me it works just fine. The problem begins right after the installation on users pc. When they click on any button it's giving them this error: "Run-time error '9' subscript out of range".
Can anyone tell me what could be wrong here, it's the first time I see this kind of error.

Thanks for your help

Run-time Error '9' : Subscript Out Of Range
Hey!!!
I'm making a kind of test in vb 5, and the code seems to be OK, but I'm having problems with one bit,
'cause the idea is to click on a button, en then a name of a country should come up, but this doesn't work because there is a run-time error.
Can anyone help me? Below will be the bit that's giving me a very hard time :

Private Sub cmdVolgende_Click()
    
    'beginwaarden
    Randomize
    gPlusPunten = 1
     gKansen = 2
     gLand(gX) = ""
    txtLand.Text = ""
    txtHoofdstad.Text = ""


    If gAantalVragen < 10 Then
        gAantalVragen = gAantalVragen + 1
          Do
            gX = Int(gAantalLanden * Rnd + 1)
            If gLand(gX) <> "" Then
                txtLand.Text = gLand(gX)
        End If
    Loop
        txtCommentaar.Text = "Vul de hoofdstad in en druk op Controleren." & vbCrLf & "Vraag: " & Str(gAantal)
    Else
        txtCommentaar.Text = "U heeft tien vragen beantwoord, de toets is afgelopen."
        txtLand.Text = ""
        gAantalVragen = 11
     End If
End Sub


(the red, italic, underlined bit is the place where the error is)



Edited by - Pienow on 6/6/2004 2:55:02 AM

Run Time Error '9' Subscript Out Of Range.. Anyone Can Help?
Hi friends,

im facing this problem now.. i have a form that only contain one datagrid and one button. in my development PC.. i have no problem with it. it work fine. BUT after i try to install it into another PC for test run. it give me "run time error '9'. Subscript out of range. im wonder why this happen. Please help..


Reneè

Finding File By Creation Time
I am creating an app and I want to go through a specific directory and get the filename of the file with latest creation time. Since it can be any directory, I won't know what the filenames are or how many files are in the directory. I there a simple way to do this? Well doesn't have to be simple. Thanks

1004 Run-time Error Using .range With .merge Only On Second Run
I have read many posts on this issue but have been unable to find one that has helped me fix this. I'm new to VB so it may be a simple error. I'm using VBA in System Architect and the macro runs perfectly the first time but throws the 1004 error when running a second time if you don't stop it running in the VBA editor. The line causing the error is marked below with ---> error and is the line concerning the merging of cells. If i comment it out then the error occurs on the next line and so on. I'm using excel 2000 with xp if that helps.

actual error
Run-time error '1004':
Method 'Cells' of object '_Global' failed


Code:
Option Explicit
Global Const IE = 141
Global Const ON = 522
Global Const CELLFONT = "Wingdings"
Dim hp3Book As Excel.Workbook
Dim sa As New SA2001.Application
Dim saDiags As SAObjects
Dim saEncyc As String
Dim i, j, k, l As Integer
Dim xlID As Double
Dim ssColl As SACollection
Dim allI As SA2001.SAObjects
Dim all As SA2001.SAObjects
Dim xl As New Excel.Application

Sub Status()

Dim hp3Sheet As Excel.Worksheet

Set sa = SA2001.Application

'Need to read in all of the IER definitions that are in the current encyclopedia
saEncyc = SA2001.Application.Encyclopedia.FullName

Set allI = sa.Encyclopedia.GetFilteredDefinitions("", IE)
allI.ReadAll 'Reads in all of the definitions that fit the filter


'Now need to get a list of all the operational nodes that are defined.
'Only need one instance of each in the list to create the matrix


Set all = sa.Encyclopedia.GetFilteredDefinitions("", ON)
all.ReadAll

'Create the Excel spreadsheet

xl.Visible = True
Set hp3Book = xl.Workbooks.Add
hp3Book.Activate

Set hp3Sheet = hp3Book.Worksheets("Sheet2")
hp3Sheet.Activate
hp3Sheet.Name = "Stat"
hp3Sheet.Cells(4, 2) = "AAA"
hp3Sheet.Cells(3, 2) = "BBB"
hp3Sheet.Cells(3, 2).HorizontalAlignment = xlRight

l = 0
For i = 1 To (allOpNodes.Count)
With hp3Sheet
.Cells(3, (3 * i) + l) = all(i).Name 'Column Titles

error ---> .Range(Cells(3, (3 * i) + l), Cells(3, (3 * i) + l + 3)).Merge 'Merging the column title cells <---- error

.Range(Cells(3, (3 * i) + l), Cells(3, (3 * i) + l + 3)).HorizontalAlignment = xlCenter
.Cells(4, (3 * i) + l) = "AA"
.Cells(4, (3 * i) + l + 1) = "AB"
.Cells(4, (3 * i) + l + 2) = "AC"
.Cells(4, (3 * i) + l + 3) = "AD"
.Range(Cells(4, (3 * i) + l), Cells(4, (3 * i) + l + 3)).Orientation = 90

l = l + 1
End With
Next

Cheers

{UNRESOLVED} Run Time Error '9' Subscript Out Of Range
I am trying to dynamically add elements from a list box into an multidimensional array. So as soon as a row with the multidimensional array is filled the for loop stops (where is says exit sub) and asks the user to insert new elements via a listbox However as soon as a get to the last element for any particular row i get the run time error. I had too out of range error i got rid of on using an if statement however cant get rid of the other one.
Really stuck, can anyone help?????

Code:
Dim loend As Integer, tlaend2 As Integer, tlaend As Integer
loend = intlevel - 1
tlaend = lstTLA.ListCount - 1
tlaend2 = Form1.Objective1.ListCount - 1

For lo = Form1.lblDisplayObj.Tag To loend     'the tag stores the row dealt with in the multidimesional array
     
   tla = 0
   For tla = 0 To tlaend
    
            If tla <= tlaend2 Then
            ReDim Preserve arrTLAObjLevel(lo, tla)        'the initiation of the multidimensional array
            arrTLAObjLevel(lo, tla) = InputBox("Which level")
            
            ElseIf tla > tlaend2 Then
            arrTLAObjLevel(lo, tla) = "2"            ' ********on the last item being inserted into the row this is where error occurs ****************

            End If
            
            MsgBox "tla = " & tla 'tells me what column in multidimensional array
            MsgBox "lo = " & lo 'tells me what row in multidimensional array

Next
        
        MsgBox "lo row filled wid i think"
        Form1.lblDisplayObj.Tag = lo + 1
        'this if statement gets rid of 2nd out of range subscript error msg
        If Form1.lblDisplayObj.Tag < loend Then
        Form1.lblDisplayObj.Caption = strObj(Form1.lblDisplayObj.Tag)
        Else
        End If
        Exit Sub
    
    Next



Edited by - sairambaba on 7/11/2005 8:16:24 AM

How To Give Time Range In Crystal Report
Hi, I am genrating one report. In that report user will enter from time, date & to time, date. I want to display transaction betweem that date & time range. if i am using only date then it is working properly, but if i am including time, i am not getting accurate result. how can i do it. wht is the syntax for time range also suggest me . shold i store date & time in different field or the in the same filed in database.

For dtae range i am using following syntax
{Command.ReciptDate} in Date(" & VBA.Format(dtpFromdate.Value, "yyyy, MM, dd") & ") to Date(" & VBA.Format(dtpToDate.Value, "yyyy, MM, dd ") & ")

How To Set Time Interval Range For Excel Reports
I have a database with records in specific time interval (10 min interval). How do I get these records in desired time interval range, like in hours, days or monmths. I have done this with crystal reports but I want to use excel for this.

thanks

Finding Hours... Sort Of Like A Time Clock Would Do
How can I make VB find the diffrence between 2 times?...

Like say... I put 2 text boxs one called txtClockIn and one called txtClockOut and a label named lblHours.

An example being... I enter 8:00 am into txtClockIn and 2:33 pm into txtClockOut how could I have VB tell me that's 6 hours and 33 min's?

i'm sure it'll have to use militrary time format(?)

Finding Differences In Time - Calculating Minutes
I have tried several ways to do this but to this point am unsucessful. If anyone knows how to accomplish the following please let me know

This has to do with time schedules
I have this data

Start Lunch End
8:00am 11:30am 5:00pm

What I need the code to do is give me the minutes they were scheduled to work and if lunch exists then subtract 60 minutes.

Thanks for any help
Garrett

Finding Date/Time Of File On FTP Server
FTp Server Get a File Date/Time Before Download
I am polling a particular file on an ftp server.

I have a problem. using wininet.,, the controls do not give me the (seconds) when i retreive the date/time of the file on the Server.

FileDateTime when looking at the local drives gives me hh:mm:ss ok. BUT under ftp,using wininet, only hh:mm

I need to look at the time,hh:mm:ss,,, to establish if it is worth getting the file from the server. ie. it has changed.

Is there any control which will let me LOOK at a file on an ftp server, and get data,hours,minutes,seconds., that works.

Or, some other way of establishing the state of the file has altered,.. (it will always be the same size!)

Appreciate any advice.

Finding IP Address For Current Machine At Run Time!
How to find the IP address for the current machine at run time?

Flexgrid Problem - Run Time Error 381 - Subscript Out Of Range
I have a flexgrid which i am populating, and then when the user clicks on a row, the data for that row is passed to textboxes.

This works fine usually until the form is refreshed
(ie. There is a refresh button, and after it is pressed, if you try to browse around, this error is thrown).
(There is also an update button which calls a refresh, and again after this, if you attempt to browse around, this error is thrown).

Can anyone help me out? What does it even mean and what am I looking for to fix ?

It has highlighted one of the lines I am passing back to a textbox using the .TextMatrix property - but I cant see the problem with this, as before the user Refreshes the page this works just fine!

Someone please help!

Runtime Error '9' Subscript Out Of Range/Time Program
Sorry for the length this will be, but I can't get where this is coming from... The line the error shows on is marked with ---------->. (Or just search for 700) It's the line after where I specified I wanted it to extend from 0-700 (weeks).  It works fine if I make i = 0 to 500, but if I make it anything but 500, it ends. I'm trying to extend the length of my time program.  If possible, could you explain why this is happening?

Private Sub MAKEHTM()
 Dim FNAME$, s1$, s2$, s3$, S4$, R1#, RALL#
 jobnamect = 1:
 jmatchon = 0
 Open "C:TMP.HTM" For Output As #1
  Print #1, "<HTML><HEAD><TITLE></TITLE></HEAD><BR>"
  Print #1, "<BLOCKQUOTE><B><PRE><CENTER>"
  Print #1, "<FONT SIZE=+3><I>WEEKLY TIME SHEET</I></FONT>"

  Print #1, "WEEK ENDING:<U> " & CVDate(WEEK2) & " </U>   NAME:<U> " & Label8.Caption & " </U>   EMP#:<U> " & Label9.Caption & " </U>"
 RALL = 0
 jobnamect = 0
 For i = 0 To 299: jobnamearry(i) = "": jobotary(i) = 0: jobtimearry(i) = 0: Next i
 For i1 = 0 To 6
  If i1 = 0 Then LCT = L1CT
  If i1 = 1 Then LCT = L2CT
  If i1 = 2 Then LCT = L3CT
  If i1 = 3 Then LCT = L4CT
  If i1 = 4 Then LCT = L5CT
  If i1 = 5 Then LCT = L6CT
  If i1 = 6 Then LCT = L7CT
  For i = 0 To LCT - 1
   If i1 = 0 Then s2 = L11(i): s3 = L12(i): S4 = L13(i)
   If i1 = 1 Then s2 = L21(i): s3 = L22(i): S4 = L23(i)
   If i1 = 2 Then s2 = L31(i): s3 = L32(i): S4 = L33(i)
   If i1 = 3 Then s2 = L41(i): s3 = L42(i): S4 = L43(i)
   If i1 = 4 Then s2 = L51(i): s3 = L52(i): S4 = L53(i)
   If i1 = 5 Then s2 = L61(i): s3 = L62(i): S4 = L63(i)
   If i1 = 6 Then s2 = L71(i): s3 = L72(i): S4 = L73(i)
   R1 = CDbl(s2) + CDbl(s3)
   
   jmatch = 0:
   If jmatchon = 0 Then jobnamearry(1) = S4: jmatchon = 1
   
   For i2 = 1 To jobnamect
    If LTrim(RTrim(S4)) = LTrim(RTrim(jobnamearry(i2))) Then
     jmatch = 1
     jobtimearry(i2) = jobtimearry(i2) + R1
    End If
   Next i2
   
'   jmatch = 0
   If jmatch = 0 Then
    jobnamect = jobnamect + 1
    jobnamearry(jobnamect) = S4
    jobtimearry(jobnamect) = jobtimearry(jobnamect) + R1
   End If
   
   RALL = RALL + R1
  Next i
 Next i1
 
 Print #1, ""
 For i2 = 1 To jobnamect
  s1 = jobnamearry(i2):  s2 = jobtimearry(i2)
  Print #1, "JOB:<U> " & s1 & " ( " & s2 & " ) "
 Next i2
 Print #1, ""
 
 s2 = "0.00"
 s3 = "40.00"
 s1 = CStr((CLng(RALL * 100) / 100#))
 If RALL > 40 Then s2 = CStr((CLng((RALL - 40) * 100) / 100#))
 If RALL <= 40 Then s3 = CStr((CLng(RALL * 100) / 100#))
 
  
  Print #1, "TOTAL HOURS:<U> " & Space(10 - Len(s1)) & s1 & " </U> OT:<U> " & Space(10 - Len(s2)) & s2 & " </U> NT:<U> " & Space(10 - Len(s3)) & s3 & " </U>"
  Print #1, "</PRE></FONT></B></BLOCKQUOTE></CENTER><HR>"

 For i1 = 0 To 6
  If i1 = 0 Then LCT = L1CT
  If i1 = 1 Then LCT = L2CT
  If i1 = 2 Then LCT = L3CT
  If i1 = 3 Then LCT = L4CT
  If i1 = 4 Then LCT = L5CT
  If i1 = 5 Then LCT = L6CT
  If i1 = 6 Then LCT = L7CT
  RALL = 0
  For i = 0 To LCT - 1
   If i1 = 0 Then s1 = L13(i): s2 = L11(i): s3 = L12(i)
   If i1 = 1 Then s1 = L23(i): s2 = L21(i): s3 = L22(i)
   If i1 = 2 Then s1 = L33(i): s2 = L31(i): s3 = L32(i)
   If i1 = 3 Then s1 = L43(i): s2 = L41(i): s3 = L42(i)
   If i1 = 4 Then s1 = L53(i): s2 = L51(i): s3 = L52(i)
   If i1 = 5 Then s1 = L63(i): s2 = L61(i): s3 = L62(i)
   If i1 = 6 Then s1 = L73(i): s2 = L71(i): s3 = L72(i)
   R1 = CDbl(s2) + CDbl(s3)
   RALL = RALL + R1
  Next i
  If RALL > 0 Then
   Print #1, "<BLOCKQUOTE><B><FONT SIZE=1><PRE>"
   s1 = CStr((CLng(RALL * 100) / 100#))
   s2 = Format(CVDate(WEEK2 - 6 + i1), "DDDD")
   '& Space((10 - Len(S2)) * 2)
   Label1.Caption = s2 & " : " & s1
   Print #1, "<FONT SIZE=+1>" & s2 & " : <U>" & Space(6 - Len(s1)) & s1 & " </U>" & " HOURS : " ' & CVDate(WEEK2 - 6 + i1) & "</FONT>"
   For i = 0 To LCT - 1
    If i1 = 0 Then s1 = L13(i): s2 = L11(i): s3 = L12(i): S4 = L15(i)
    If i1 = 1 Then s1 = L23(i): s2 = L21(i): s3 = L22(i): S4 = L25(i)
    If i1 = 2 Then s1 = L33(i): s2 = L31(i): s3 = L32(i): S4 = L35(i)
    If i1 = 3 Then s1 = L43(i): s2 = L41(i): s3 = L42(i): S4 = L45(i)
    If i1 = 4 Then s1 = L53(i): s2 = L51(i): s3 = L52(i): S4 = L55(i)
    If i1 = 5 Then s1 = L63(i): s2 = L61(i): s3 = L62(i): S4 = L65(i)
    If i1 = 6 Then s1 = L73(i): s2 = L71(i): s3 = L72(i): S4 = L75(i)
    s1 = Left(RTrim(LTrim(s1)), 29)
    s2 = RTrim(LTrim(s2))
    s3 = RTrim(LTrim(s3))
    Label1.Caption = s1 & ":" & s2 & ":" & s3
    Print #1, "    JOB:<U> " & Space(30 - Len(s1)) & s1 & " </U> OT:<U> " & Space(10 - Len(s2)) & s2 & " </U> NT:<U> " & Space(10 - Len(s3)) & s3 & " </U>"
    
    Print #1, "      " & S4
   Next i
   Print #1, "</PRE></FONT></B></BLOCKQUOTE><HR>"
  End If
  Next i1
 
 Close #1
End Sub

Private Sub STDGET()
 s1 = Dir("C:TIMEinfo.STD", 0)
 If s1 <> "" Then
  Open "C:TIMEinfo.STD" For Input As #9:
   Input #9, drv1
   Input #9, s1: WEEK2 = CDbl(s1)
   EMPCT = 0
   Do While Not EOF(9)
    Input #9, NAME1(EMPCT): Input #9, EMP1(EMPCT)
    EMPCT = EMPCT + 1
   Loop
   Label8.Caption = NAME1(0): Label9.Caption = EMP1(0)
   FDATA = drv1 & ":TIME" & EMP1(0) & ""
  Close #9
 End If
End Sub


Private Sub bclr()
 Command3.FontBold = False: Command4.FontBold = False: Command5.FontBold = False: Command6.FontBold = False: Command7.FontBold = False: Command8.FontBold = False: Command9.FontBold = False:
End Sub

Private Sub Combo1_Click()
 Dim i1%, i2%
 i2 = Combo1.ListIndex
 LSTJOBDWG
 i1 = List2.ListIndex
 If i1 >= 0 Then
  If i2 >= 0 Then Text3.Text = JOB(i2)
 End If
End Sub

Private Sub Combo2_Click()
 Dim i1%, i2%
 i2 = Combo2.ListIndex
 LSTJOBDWG
 i1 = List2.ListIndex
 If i1 >= 0 Then
  If i2 >= 0 Then Text4.Text = DWG(i2)
 End If
End Sub

Private Sub Command1_Click()
 If BCT = 1 Then L11(L1CT) = "0": L12(L1CT) = "0": L13(L1CT) = "JOB": L14(L1CT) = "DWG": L15(L1CT) = "DESC": L16(L1CT) = 0: L1CT = L1CT + 1: L2UPD 0
 If BCT = 2 Then L21(L2CT) = "0": L22(L2CT) = "0": L23(L2CT) = "JOB": L24(L1CT) = "DWG": L25(L2CT) = "DESC": L26(L2CT) = 0: L2CT = L2CT + 1: L2UPD 0
 If BCT = 3 Then L31(L3CT) = "0": L32(L3CT) = "0": L33(L3CT) = "JOB": L34(L1CT) = "DWG": L35(L3CT) = "DESC": L36(L3CT) = 0: L3CT = L3CT + 1: L2UPD 0
 If BCT = 4 Then L41(L4CT) = "0": L42(L4CT) = "0": L43(L4CT) = "JOB": L44(L1CT) = "DWG": L45(L4CT) = "DESC": L46(L4CT) = 0: L4CT = L4CT + 1: L2UPD 0
 If BCT = 5 Then L51(L5CT) = "0": L52(L5CT) = "0": L53(L5CT) = "JOB": L54(L1CT) = "DWG": L55(L5CT) = "DESC": L56(L5CT) = 0: L5CT = L5CT + 1: L2UPD 0
 If BCT = 6 Then L61(L6CT) = "0": L62(L6CT) = "0": L63(L6CT) = "JOB": L64(L1CT) = "DWG": L65(L6CT) = "DESC": L66(L6CT) = 0: L6CT = L6CT + 1: L2UPD 0
 If BCT = 7 Then L71(L7CT) = "0": L72(L7CT) = "0": L73(L7CT) = "JOB": L74(L1CT) = "DWG": L75(L7CT) = "DESC": L76(L7CT) = 0: L7CT = L7CT + 1: L2UPD 0

End Sub

Private Sub Command10_Click()
 FILEWR
End Sub

Private Sub Command11_Click()
 Dim i1%, i2%, i%
 i = List2.ListIndex
 If i >= 0 Then
  
  If BCT = 1 Then
   If L1CT > 0 Then
    For i2 = 0 To L1CT + 10: L81(i2) = L11(i2): L82(i2) = L12(i2): L83(i2) = L13(i2): L84(i2) = L14(i2): L85(i2) = L15(i2): Next i2
    i1 = 0
    For i2 = 0 To L1CT + 10: L11(i1) = L81(i2): L12(i1) = L82(i2): L13(i1) = L83(i2): L14(i1) = L84(i2): L15(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L1CT = L1CT - 1: If i >= L1CT Then i = 0
   End If
  End If
  
  If BCT = 2 Then
   If L2CT > 0 Then
    For i2 = 0 To L2CT + 10: L81(i2) = L21(i2): L82(i2) = L22(i2): L83(i2) = L23(i2): L84(i2) = L24(i2): L85(i2) = L25(i2): Next i2
    i1 = 0
    For i2 = 0 To L2CT + 10: L21(i1) = L81(i2): L22(i1) = L82(i2): L23(i1) = L83(i2): L24(i1) = L84(i2): L25(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L2CT = L2CT - 1: If i >= L2CT Then i = 0
   End If
  End If
  
  If BCT = 3 Then
   If L3CT > 0 Then
    For i2 = 0 To L3CT + 10: L81(i2) = L31(i2): L82(i2) = L32(i2): L83(i2) = L33(i2): L84(i2) = L34(i2): L85(i2) = L35(i2): Next i2
    i1 = 0
    For i2 = 0 To L3CT + 10: L31(i1) = L81(i2): L32(i1) = L82(i2): L33(i1) = L83(i2): L34(i1) = L84(i2): L35(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L3CT = L3CT - 1: If i >= L3CT Then i = 0
   End If
  End If
  
  If BCT = 4 Then
   If L4CT > 0 Then
    For i2 = 0 To L4CT + 10: L81(i2) = L41(i2): L82(i2) = L42(i2): L83(i2) = L43(i2): L84(i2) = L44(i2): L85(i2) = L45(i2): Next i2
    i1 = 0
    For i2 = 0 To L4CT + 10: L41(i1) = L81(i2): L42(i1) = L82(i2): L43(i1) = L83(i2): L44(i1) = L84(i2): L45(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L4CT = L4CT - 1: If i >= L4CT Then i = 0
   End If
  End If
  
  If BCT = 5 Then
   If L5CT > 0 Then
    For i2 = 0 To L5CT + 10: L81(i2) = L51(i2): L82(i2) = L52(i2): L83(i2) = L53(i2): L84(i2) = L54(i2): L85(i2) = L55(i2): Next i2
    i1 = 0
    For i2 = 0 To L5CT + 10: L51(i1) = L81(i2): L52(i1) = L82(i2): L53(i1) = L83(i2): L54(i1) = L84(i2): L55(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L5CT = L5CT - 1: If i >= L5CT Then i = 0
   End If
  End If
  
  If BCT = 6 Then
   If L6CT > 0 Then
    For i2 = 0 To L6CT + 10: L81(i2) = L61(i2): L82(i2) = L62(i2): L83(i2) = L63(i2): L84(i2) = L64(i2): L85(i2) = L65(i2): Next i2
    i1 = 0
    For i2 = 0 To L6CT + 10: L61(i1) = L81(i2): L62(i1) = L82(i2): L63(i1) = L83(i2): L64(i1) = L84(i2): L65(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L6CT = L6CT - 1: If i >= L6CT Then i = 0
   End If
  End If
  
  If BCT = 7 Then
   If L7CT > 0 Then
    For i2 = 0 To L7CT + 10: L81(i2) = L71(i2): L82(i2) = L72(i2): L83(i2) = L73(i2): L84(i2) = L74(i2): L85(i2) = L75(i2): Next i2
    i1 = 0
    For i2 = 0 To L7CT + 10: L71(i1) = L81(i2): L72(i1) = L82(i2): L73(i1) = L83(i2): L74(i1) = L84(i2): L75(i1) = L85(i2):
     If i2 <> i Then i1 = i1 + 1
    Next i2
    L7CT = L7CT - 1: If i >= L7CT Then i = 0
   End If
  End If
  
  L2UPD i
'  List2.ListIndex = i
 End If
End Sub

Private Sub Command12_Click()
 Dim OPT%
 s2 = "C:TEMPFILE.OPT": s1 = Dir(s2, ATTR_FILE): If s1 <> "" Then Kill (s2)
 s1 = drv1 & ":TIMEFTIME.BAT": X = Shell(s1, 6)
 OPT = 0
 Do While OPT = 0
  For i = 0 To 100: For i1 = 0 To 100: Next i1: Next i
  s1 = Dir(s2, ATTR_FILE)
  If s1 <> "" Then OPT = 1
 Loop
 Load TIME1
 TIME1.Show
End Sub

Private Sub Command2_Click()
  FILEWR
  MAKEHTM
  s3 = "C: mp.htm":
  OLE1.Visible = True:
  OLE1.SourceItem = s3:
  OLE1.SourceDoc = s3:
  OLE1.Action = 1
  OLE1.Action = 7
End Sub

Private Sub Command3_Click()
 BCT = 1: bclr: Command3.FontBold = True: L2UPD 0
End Sub

Private Sub Command4_Click()
 BCT = 2: bclr: Command4.FontBold = True: L2UPD 0
End Sub

Private Sub Command5_Click()
 BCT = 3: bclr: Command5.FontBold = True: L2UPD 0
End Sub

Private Sub Command6_Click()
 BCT = 4: bclr: Command6.FontBold = True: L2UPD 0
End Sub

Private Sub Command7_Click()
 BCT = 5: bclr: Command7.FontBold = True:  L2UPD 0
End Sub

Private Sub Command8_Click()
 BCT = 6: bclr: Command8.FontBold = True: L2UPD 0
End Sub

Private Sub Command9_Click()
 BCT = 7: bclr: Command9.FontBold = True: L2UPD 0
End Sub

Private Sub FILEREAD(FN$)
 Dim s1$, s2$, s3$, S4$, S10$
 Open FN For Input As #9:
  L1CT = 0: L2CT = 0: L3CT = 0: L4CT = 0: L5CT = 0: L6CT = 0: L7CT = 0:
  S10 = strout()
  Do While Left(S10, 1) = "^"
   If Left(S10, 2) = "^1" Then L11(L1CT) = strout(): L12(L1CT) = strout(): L13(L1CT) = strout(): L14(L1CT) = strout(): L15(L1CT) = strout(): S10 = strout(): L1CT = L1CT + 1
   If Left(S10, 2) = "^2" Then L21(L2CT) = strout(): L22(L2CT) = strout(): L23(L2CT) = strout(): L24(L2CT) = strout(): L25(L2CT) = strout(): S10 = strout(): L2CT = L2CT + 1
   If Left(S10, 2) = "^3" Then L31(L3CT) = strout(): L32(L3CT) = strout(): L33(L3CT) = strout(): L34(L3CT) = strout(): L35(L3CT) = strout(): S10 = strout(): L3CT = L3CT + 1
   If Left(S10, 2) = "^4" Then L41(L4CT) = strout(): L42(L4CT) = strout(): L43(L4CT) = strout(): L44(L4CT) = strout(): L45(L4CT) = strout(): S10 = strout(): L4CT = L4CT + 1
   If Left(S10, 2) = "^5" Then L51(L5CT) = strout(): L52(L5CT) = strout(): L53(L5CT) = strout(): L54(L5CT) = strout(): L55(L5CT) = strout(): S10 = strout(): L5CT = L5CT + 1
   If Left(S10, 2) = "^6" Then L61(L6CT) = strout(): L62(L6CT) = strout(): L63(L6CT) = strout(): L64(L6CT) = strout(): L65(L6CT) = strout(): S10 = strout(): L6CT = L6CT + 1
   If Left(S10, 2) = "^7" Then L71(L7CT) = strout(): L72(L7CT) = strout(): L73(L7CT) = strout(): L74(L7CT) = strout(): L75(L7CT) = strout(): S10 = strout(): L7CT = L7CT + 1
  Loop
 Close #9
End Sub

Private Sub FILEWR()
 Open FN1 For Output As #1
 For i = 0 To L1CT - 1: Print #1, "^1": Print #1, L11(i): Print #1, L12(i): Print #1, L13(i): Print #1, L14(i): Print #1, L15(i): Next i
 For i = 0 To L2CT - 1: Print #1, "^2": Print #1, L21(i): Print #1, L22(i): Print #1, L23(i): Print #1, L24(i): Print #1, L25(i): Next i
 For i = 0 To L3CT - 1: Print #1, "^3": Print #1, L31(i): Print #1, L32(i): Print #1, L33(i): Print #1, L34(i): Print #1, L35(i): Next i
 For i = 0 To L4CT - 1: Print #1, "^4": Print #1, L41(i): Print #1, L42(i): Print #1, L43(i): Print #1, L44(i): Print #1, L45(i): Next i
 For i = 0 To L5CT - 1: Print #1, "^5": Print #1, L51(i): Print #1, L52(i): Print #1, L53(i): Print #1, L54(i): Print #1, L55(i): Next i
 For i = 0 To L6CT - 1: Print #1, "^6": Print #1, L61(i): Print #1, L62(i): Print #1, L63(i): Print #1, L64(i): Print #1, L65(i): Next i
 For i = 0 To L7CT - 1: Print #1, "^7": Print #1, L71(i): Print #1, L72(i): Print #1, L73(i): Print #1, L74(i): Print #1, L75(i): Next i
 Print #1, "~":
 Close #1
End Sub

'
Private Sub Form_Load()
 Dim i%, s1$, s2$, s3$, S4$, S5$, S10$
 drv1 = "H"
 RUN = 0: L1CT = 0
 STDGET
 WEEK1 = WEEK2

 For i = 0 To EMPCT: List3.AddItem NAME1(i): Next i
 If EMPCT < 2 Then List3.Visible = False
 If EMPCT < 2 Then Command12.Visible = False

 For i = 0 To 700 '300 '240
----------->  WEEK(i) = CVDate(WEEK1)<---------------
  S5 = WEEK(i) '& Space(20)
'  S5 = Space((9 - Len(S5)) * 2) & S5 & " "
  List1.AddItem S5
  WEEK1 = WEEK1 + 7
 Next i

 WEEK1 = WEEK2
 
 
' i1 = List1.ListIndex
' WEEK2 = WEEK1 + (i1 * 7)
 
 
 R1 = CLng(Date): R1 = R1 - WEEK1: R1 = R1 / 7: R1 = CLng(R1)
 List1.ListIndex = R1
  
 LSTJOBDWG

' ' CREATE LISTS
' Dim OPT%
' S2 = "C:TEMPFILE.OPT": S1 = Dir(S2, ATTR_FILE): If S1 <> "" Then Kill (S2)
' S1 = drv1 & ":TIMETIMEFTIME.BAT": X = Shell(S1, 6)

' OPT = 0
' Do While OPT = 0
'  For i = 0 To 100: For i1 = 0 To 100: Next i1: Next i
'  S1 = Dir(S2, ATTR_FILE)
'  If S1 <> "" Then OPT = 1
' Loop

End Sub

Private Sub ITEMCLR()
 Text1.Text = "": Text2.Text = "":    Text3.Text = "": Text4.Text = "": Text5.Text = "":
End Sub

Private Sub L2UPD(LCT%)
 List2.Clear
 
 If BCT = 1 Then
  If L1CT > 0 Then
    For i = 0 To L1CT - 1: List2.AddItem L13(i) & " : " & L15(i): Next i: If L1CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If
 
 If BCT = 2 Then
  If L2CT > 0 Then
   For i = 0 To L2CT - 1: List2.AddItem L23(i) & " : " & L25(i): Next i: If L2CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If

 If BCT = 3 Then
  If L3CT > 0 Then
   For i = 0 To L3CT - 1: List2.AddItem L33(i) & " : " & L35(i): Next i: If L3CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If
 
 If BCT = 4 Then
  If L4CT > 0 Then
   For i = 0 To L4CT - 1: List2.AddItem L43(i) & " : " & L45(i): Next i: If L4CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If

 If BCT = 5 Then
  If L5CT > 0 Then
   For i = 0 To L5CT - 1: List2.AddItem L53(i) & " : " & L55(i): Next i: If L5CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If
 
 If BCT = 6 Then
  If L6CT > 0 Then
   For i = 0 To L6CT - 1: List2.AddItem L63(i) & " : " & L65(i): Next i: If L6CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If

 If BCT = 7 Then
  If L7CT > 0 Then
   For i = 0 To L7CT - 1: List2.AddItem L73(i) & " : " & L75(i): Next i: If L7CT > 0 Then List2.ListIndex = LCT
  Else
   ITEMCLR
  End If
 End If

End Sub

Private Sub List1_Click()
 Frame1.Visible = True
 L1CT = 0: L2CT = 0: L3CT = 0: L4CT = 0: L5CT = 0: L6CT = 0: L7CT = 0:
 List2.Clear
 Text1.Text = "": Text2.Text = "":    Text3.Text = "": Text4.Text = "": Text5.Text = "":
 i1 = List1.ListIndex
 WEEK2 = WEEK1 + (i1 * 7)
 FN1 = FDATA & "ts" & i1 & ".Txt"
' label1.Caption = FN1
 '''''
 s1 = Dir(FN1, vbNormal)
 If s1 = "" Then Open FN1 For Output As #1: Print #1, "": Close #1
 
 FILEREAD FN1
 BCT = 1: bclr: Command3.FontBold = True: L2UPD 0
 Command3.Caption = Format(CVDate(WEEK2 - 6), "DDD") & " : " & CVDate(WEEK2 - 6)
 Command4.Caption = Format(CVDate(WEEK2 - 5), "DDD") & " : " & CVDate(WEEK2 - 5)
 Command5.Caption = Format(CVDate(WEEK2 - 4), "DDD") & " : " & CVDate(WEEK2 - 4)
 Command6.Caption = Format(CVDate(WEEK2 - 3), "DDD") & " : " & CVDate(WEEK2 - 3)
 Command7.Caption = Format(CVDate(WEEK2 - 2), "DDD") & " : " & CVDate(WEEK2 - 2)
 Command8.Caption = Format(CVDate(WEEK2 - 1), "DDD") & " : " & CVDate(WEEK2 - 1)
 Command9.Caption = Format(CVDate(WEEK2), "DDD") & " : " & CVDate(WEEK2)
' ITEMCLR
End Sub

Private Sub List2_Click()
  RUN = 1
  LOP = 0: i1 = List2.ListIndex:
  If BCT = 1 Then s1 = L11(i1): s2 = L12(i1): s3 = L13(i1): S4 = L14(i1): S5 = L15(i1)
  If BCT = 2 Then s1 = L21(i1): s2 = L22(i1): s3 = L23(i1): S4 = L24(i1): S5 = L25(i1)
  If BCT = 3 Then s1 = L31(i1): s2 = L32(i1): s3 = L33(i1): S4 = L34(i1): S5 = L35(i1)
  If BCT = 4 Then s1 = L41(i1): s2 = L42(i1): s3 = L43(i1): S4 = L44(i1): S5 = L45(i1)
  If BCT = 5 Then s1 = L51(i1): s2 = L52(i1): s3 = L53(i1): S4 = L54(i1): S5 = L55(i1)
  If BCT = 6 Then s1 = L61(i1): s2 = L62(i1): s3 = L63(i1): S4 = L64(i1): S5 = L65(i1)
  If BCT = 7 Then s1 = L71(i1): s2 = L72(i1): s3 = L73(i1): S4 = L74(i1): S5 = L75(i1)
  Text1.Text = s1: Text2.Text = s2:    Text3.Text = s3: Text4.Text = S4: Text5.Text = S5:
  LOP = 1
End Sub

Private Sub List3_Click()
 i = List3.ListIndex
 If i >= 0 Then
  Label8.Caption = NAME1(i): Label9.Caption = EMP1(i)
  FDATA = drv1 & ":TIME" & EMP1(i) & ""
''  List1.ListIndex = 1
  R1 = CLng(Date): R1 = R1 - WEEK1: R1 = R1 / 7: R1 = CLng(R1)
  List1.ListIndex = R1
  List1_Click
 End If
End Sub

Private Sub LSTJOBDWG()
 Dim i1%, i2%
 Combo1.Clear: Combo2.Clear
' READ FROM OUTSIDE DATA FILE FOR JOB
 s2 = "C:TIME" & "job.STD": s1 = Dir(s2, 0)
 If s1 <> "" Then
  Open s2 For Input As #9: JOBCT = 1
   JOB(0) = " "
   Do While Not EOF(9)
    JOB(JOBCT) = strout(): If RTrim(LTrim(JOB(JOBCT))) <> "" Then JOBCT = JOBCT + 1
   Loop
  Close #9
 End If
 For i = 0 To JOBCT - 1: Combo1.AddItem JOB(i): Next i

' READ FROM OUTSIDE DATA FILE FOR DWG
 s2 = "C:TIME" & "DWG.STD": s1 = Dir(s2, 0)
 If s1 <> "" Then
  Open s2 For Input As #9: DWGCT = 1
   DWG(0) = " "
   Do While Not EOF(9)
    DWG(DWGCT) = strout(): If RTrim(LTrim(DWG(DWGCT))) <> "" Then DWGCT = DWGCT + 1
   Loop
  Close #9
 End If
 For i = 0 To DWGCT - 1: Combo2.AddItem DWG(i): Next i
End Sub

Private Sub LSTUPD()
 Dim i1%
 If LOP = 1 Then
  i1 = List2.ListIndex
  If BCT = 1 Then If i1 >= 0 Then L11(i1) = Text1.Text: L12(i1) = Text2.Text: L13(i1) = Text3.Text: L14(i1) = Text4.Text: L15(i1) = Text5.Text
  If BCT = 2 Then If i1 >= 0 Then L21(i1) = Text1.Text: L22(i1) = Text2.Text: L23(i1) = Text3.Text: L24(i1) = Text4.Text: L25(i1) = Text5.Text
  If BCT = 3 Then If i1 >= 0 Then L31(i1) = Text1.Text: L32(i1) = Text2.Text: L33(i1) = Text3.Text: L34(i1) = Text4.Text: L35(i1) = Text5.Text
  If BCT = 4 Then If i1 >= 0 Then L41(i1) = Text1.Text: L42(i1) = Text2.Text: L43(i1) = Text3.Text: L44(i1) = Text4.Text: L45(i1) = Text5.Text
  If BCT = 5 Then If i1 >= 0 Then L51(i1) = Text1.Text: L52(i1) = Text2.Text: L53(i1) = Text3.Text: L54(i1) = Text4.Text: L55(i1) = Text5.Text
  If BCT = 6 Then If i1 >= 0 Then L61(i1) = Text1.Text: L62(i1) = Text2.Text: L63(i1) = Text3.Text: L64(i1) = Text4.Text: L65(i1) = Text5.Text
  If BCT = 7 Then If i1 >= 0 Then L71(i1) = Text1.Text: L72(i1) = Text2.Text: L73(i1) = Text3.Text: L74(i1) = Text4.Text: L75(i1) = Text5.Text

' LST5(i1) = CDbl(LST1(i1)) * CDbl(LST2(i1))
  L2UPD i1
'  List2.ListIndex = i1
 End If
End Sub
Private Function strout() As String
 If Not EOF(9) Then
  TEXTDATA = "": Char = Input(1, #9):
  While Char <> Chr(10):
   TEXTDATA = TEXTDATA & Char:
   Char = Input(1, #9):
  Wend:
  strout = Left(TEXTDATA, Len(TEXTDATA) - 1)
 End If
End Function

Private Sub Text1_Change()
 If RUN > 0 Then LSTUPD
End Sub

Private Sub Text2_Change()
 If RUN > 0 Then LSTUPD
End Sub

Private Sub Text3_Change()
 If RUN > 0 Then LSTUPD
End Sub

Private Sub Text4_Change()
 If RUN > 0 Then LSTUPD
End Sub

Private Sub Text5_Change()
 If RUN > 0 Then LSTUPD
End Sub



Flexgrid Problem - Run Time Error 381 - Subscript Out Of Range
I have a flexgrid which i am populating, and then when the user clicks on a row, the data for that row is passed to textboxes.

This works fine usually until the form is refreshed
(ie. There is a refresh button, and after it is pressed, if you try to browse around, this error is thrown).
(There is also an update button which calls a refresh, and again after this, if you attempt to browse around, this error is thrown).

Can anyone help me out? What does it even mean and what am I looking for to fix ?

It has highlighted one of the lines I am passing back to a textbox using the .TextMatrix property - but I cant see the problem with this, as before the user Refreshes the page this works just fine!

Someone please help!

##Real Urgent && Simple Help NEEDED! Complete Details Inside.. Pls Take Time To Read##
Hi,

Now i really need help! Ive been trying to get around this from long time and its getting me pissed. Please take time to read entirely.

I use Ares p2p Very often.. if you dont have it pls take time to get it from here www.aresgalaxy.org << PLease download and install it takes hardly a minute 1.5 mb only...
Now g2 Chatrooms in it. It will display a list of chatrooms.. Select any chatroom in the list and join. Now we can see the message from where we send message to the chatroom...

Now wat I want to do is... Set a handle with that text box so watever i type in my Vb textbox goes into that Ares Chatroom textbox when i click a button. How do i do it?

The title bar is variable ... Pls install the program ull understand my situation

I just want to knw this to almost complete my program. I want to send messages to that Ares box. im still learnin myself but need to finish this problem i have.

There is even an example program which does it. I have attached it with this post download it and see an example of it! Im really stuck! just help me out with this one. If some1 cud post up the code it wud be really great and another thing helpful is that whenever i activate the Ares window the focus goes on textbox this cud be helpful someway.

Pls take time to solve my problem. I wud give watever reputations a person wants for the solution to this .

Thanks in advance
Awaiting reply

Copyright © 2005-08 www.BigResource.com, All rights reserved