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...
Just a suggestion:
If your doing all this in Access to begin with why not try the following:
Step1 - Create a Form (ie; Name = Form2)
Step2 - Add a one text box to form (ie; Name = Text0)
Step3 - Create the following query (Cut & paste below)
call it EReceipts
SELECT E.Employee_ID...
I have had this problem with Oracle Databases. You can try a couple things like:
using CDate
Cells(1, i + 2).Value = Format(CDate(varFieldValue), "Short Date")
or the following line after the line above
.Cells(1, i + 2).NumberFormat = "mm/dd/yyyy"
Hope it helps
Hi Neil
Good luck trying to find sample code that will extract imbeded pictures from Excel. I will keep my eyes on this post to see if anyone has some samples but in the mean time - One thing you can do is use the Save AS HTML option and it will extract the images for you into a directory.
Hi Neil
Just a suggestion. As an alternative could you store the pictures files in a directory and then store the path / file name as a string in the database. Add an OLE / picture box to the form and then reference / load the picture as per record selected ? May be even easier to implement...
Would this work ?
Probably more effective ways then even this but give you an idea of a For Loop and using a variable to hold a Row Number.
Sub Sample()
Dim R As Long
'Loop till R = 600
For R = 2 To 600
'Cells(RowNumber,ColNumber)
Cells(R, 3).FormulaR1C1 =...
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.