C
ChrisP
I'm relatively new to VB so please bare with me...
I have a spreadsheet that has VB that pulls information from a SQL server.
Here is the part of the code I think we need to fix:
strSQL = "SELECT ProjNum, ProjName FROM tblProjectList order by ProjNum"
Set recProjList = New ADODB.Recordset
recProjList.CursorLocation = adUseClient
recProjList.CursorType = adOpenStatic
recProjList.Open strSQL, connTMSDB
Worksheets("Project Numbers").Activate
ActiveSheet.Unprotect "locked"
Cells.Select
Selection.Delete
Cells(1, 1).Value = "Project #"
Cells(1, 2).Value = "Project Name"
Columns("A:A").ColumnWidth = 15
Columns("B:B").ColumnWidth = 54
Range("A1:B1").Select
Selection.Font.Bold = True
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
recProjList.MoveFirst
intRow = 2
Do While Not recProjList.EOF
Cells(intRow, 1).Value = recProjList!ProjNum
Cells(intRow, 2).Value = recProjList!ProjName
recProjList.MoveNext
intRow = intRow + 1
Loop
ActiveSheet.Protect "locked", DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Timesheet").Activate
The table tblProjectList has a column called CompletedDate and I would like
the SQL select statement to only bring back the items where the completeddate
Thanks,
Chris
I have a spreadsheet that has VB that pulls information from a SQL server.
Here is the part of the code I think we need to fix:
strSQL = "SELECT ProjNum, ProjName FROM tblProjectList order by ProjNum"
Set recProjList = New ADODB.Recordset
recProjList.CursorLocation = adUseClient
recProjList.CursorType = adOpenStatic
recProjList.Open strSQL, connTMSDB
Worksheets("Project Numbers").Activate
ActiveSheet.Unprotect "locked"
Cells.Select
Selection.Delete
Cells(1, 1).Value = "Project #"
Cells(1, 2).Value = "Project Name"
Columns("A:A").ColumnWidth = 15
Columns("B:B").ColumnWidth = 54
Range("A1:B1").Select
Selection.Font.Bold = True
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
recProjList.MoveFirst
intRow = 2
Do While Not recProjList.EOF
Cells(intRow, 1).Value = recProjList!ProjNum
Cells(intRow, 2).Value = recProjList!ProjName
recProjList.MoveNext
intRow = intRow + 1
Loop
ActiveSheet.Protect "locked", DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Timesheet").Activate
The table tblProjectList has a column called CompletedDate and I would like
the SQL select statement to only bring back the items where the completeddate
today's date. I have no clue how to do this. Any help is appreciated!
Thanks,
Chris