Hi ersatz
In your SQL you are using the pound sign which indicates to me that the fields in the database are defined as date fields ?
Are you sure that D1 and D2 are also defined as Date values
Example if maybe try something like the following
d1 = Format(CDate(d1,"MM/DD/YYY"))
d2...
Hi Darlene
I have not checked into it but from the description of the error it sounds like the IsOpen method is not available to the Workbook object. The sample I gave was geared more for highlighting a possible structure for your "If" statement.
I am not sure if the workbooks...
Something like this maybe ?
If xlWB.IsOpen = True Then
If xlWB2.IsOpen = True Then
If xlWB3.IsOpen = True Then
MsgBox "All Available files are In use, Try Later", vbOKCancel
Else
'xlWB3...
Maybe try building on Ram's idea but use Shape ?
Sub Sample()
For Each Sht In ActiveWorkbook.Sheets
For Each cht In Worksheets(Sht.Name).Shapes
If cht.Type = msoChart Then
'MsgBox cht.Name
cht.delete
End If
Next cht...
Add 1 line as shown below
Sub LoopDeLoop(strPath As String)
Dim objFSO As FileSystemObject
Dim objFolder As Folder
Dim objSubFldr As Folder
Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(strPath)
For Each objSubFldr In objFolder.SubFolders
Debug.Print...
You have to MoveLast before you can use the recordcount
but that will produce an error also so you can either handle an empty recordset with error handling or perhaps try a DO while Not rs.EOF
Just a couple quick ideas ?
Sub Sample1()
On Error Goto ErrorHandler
rs.movefirst
Exit Sub...
In DAO you can use the RecordCount to return the number of records but in ADO you can not. If using ADO maybe use a counter and test its value
ADO Example:
Dim intRec as Integer
Do while not rsRecordset.EOF
'Do your stuff
intRec = intRec + 1
next rsRecordset
Loop
If intRec < 1 then...
Hi M.Smith
Normally (Rare actually) I will use it to evaluate a numeric expression inside a string
Example:
Sub Sample()
Msgbox Evaluate("1 + 2")
End Sub
You can also use it to call on other functions but never have had cause - hopefully Yu can shed some light on why we...
I believe the only option available to you is the WorkSheet_Change event handling procedures that runs when ever the value of ANY cell on the Worksheet changes.
Private Sub Worksheet_Change(ByVal Target As Range)
For Each c In Range("C2:C6,D5:D6")
If c.Address =...
Your closer than you think - try
Function myadd(a As Double, b As Double) As Double
myadd = a + b
End Function
Sub test()
MsgBox Evaluate("myadd( " & 2.3 & ", " & 2.3 & ")")
End Sub
Hope it helps
Add this to your ThisWorkbook module and adjust Sheet names and ranges as necessary.
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim lngRow As Long
Dim intCol As Integer
lngRow = ActiveCell.Row
intCol = ActiveCell.Column
If...
Sorry dkwong if I am still not understanding but could you not just use an "OR" clause in the SQL ?
"OR" clause example below (You would have to replace references to the Textboxes as required - point them to the filter ?):
SELECT E.Employee_ID, E.Employee_Name...
'Add reference to Microsoft Excel 9.0 Object Library
Private Sub Command1_Click()
Dim wbPath As String
Set xlApp = CreateObject("Excel.Application")
xlApp.AskToUpdateLinks = False
xlApp.DisplayAlerts = False
'xlApp.Visible = True
wbPath =...
Try adding this to you ThisWorkBook module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim UserPrompt As Long
UserPrompt = MsgBox("Quit ?", vbQuestion + vbYesNo, "QUIT ?")
If UserPrompt = vbNo Then
Cancel = True
End...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.