Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Some kind of pop up window

Status
Not open for further replies.

Sql7user

MIS
Oct 2, 2002
16
SE
Hi,

I have been programming a application in Excel VBA where I have some choises on the first page (for ex date) then I use a ADO connection to a SQL server where I get out the data of my choises. Finally, based on the data, a graph is coming up showing up the result.

Here is the question, it takes some time to get out the data and then bulding the graph and i would like a kind of pop up screen coming up under the time I wait for the graph to be finished saying something like "processing data". And it wouldnt be wrong if there was some moving things like for example dots going forward and back, forward and back
(. .. ... .... ..... ......, . .. ... .... ..... etc).

Is there any programmer out there whos have done this before I would be greatful!!!

Txs in advance!
 
Sounds like we're trying to do the same thing! I have almost managed to to work it but have run into problems. I get a form to come up that displays what query is running but it doesn't move onto the next query until the user closes the form...my code is below..have you found a way of doing it? Also I use an ODBC connection to SQL server, what is the ADO connection you're using?

'Query database for each specialist in name coloumn
Dim OpenQuery As String
Dim ClosedQuery As String
Dim StartDate
Dim EndDate
Dim Row

StartDate = Format(Cells(4, 4).Value - 1, "yyyy-mm-dd HH:MM:SS")
EndDate = Format(Cells(4, 4).Value + 5, "yyyy-mm-dd HH:MM:SS")
Row = 6

For i = 1 To 18

frmUpdate.Show
frmUpdate.lblLabel.Caption = "Please Wait, Retrieving Stats for" & Chr(32) & Cells(Row, 3)

OpenQuery = "SELECT Count(*) AS 'Cases Created' FROM Vantive.dbo.SW_HD_CASE SW_HD_CASE WHERE (SW_HD_CASE.swDateCreated Between {ts '" & StartDate & "'} And {ts '" & EndDate & "'}) AND (SW_HD_CASE.swCreatedBy='" & Cells(Row, 3) & "')"

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=SQL Server;UID=user;PWD=password;APP=Microsoft® Query;DATABASE=Database" _
, Destination:=Cells(Row, 16))
.CommandText = Array(OpenQuery)
.Name = "Open"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Cells(Row, 16).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.ColorIndex = 54
With Selection
.HorizontalAlignment = xlCenter
End With

SpecialistID = Cells(Row, 1)
ClosedQuery = "SELECT Count(*) AS 'Cases Closed' FROM Vantive.dbo.SW_HD_CASE SW_HD_CASE WHERE (SW_HD_CASE.swDateResolved Between {ts '" & StartDate & "'} And {ts '" & EndDate & "'}) AND (SW_HD_CASE.swResolvedBy=" & SpecialistID & ")"

With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=SQL Server;UID=user;PWD=password;APP=Microsoft® Query;DATABASE=Database" _
, Destination:=Cells(Row, 17))
.CommandText = Array(ClosedQuery)
.Name = "Closed"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
Cells(Row, 17).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.ColorIndex = 14
With Selection
.HorizontalAlignment = xlCenter
End With

Row = Row + 1
Next i

Range("C5").Select

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top