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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by kevinclark

  1. kevinclark

    select data from table

    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...
  2. kevinclark

    ANOTHER DILEMMA FOR ANY ACCESS/EXCEL EXPERT!!"HELP"

    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...
  3. kevinclark

    ANOTHER DILEMMA FOR ANY ACCESS/EXCEL EXPERT!!"HELP"

    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...
  4. kevinclark

    Deleting Charts in Excel

    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...
  5. kevinclark

    How can I make this recursive?

    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...
  6. kevinclark

    empty recordset

    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...
  7. kevinclark

    Display message when there are no query results!

    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...
  8. kevinclark

    execute a subroutine or function via a string

    Hi M.Smith Normally (Rare actually) I will use it to evaluate a numeric expression inside a string Example: Sub Sample() Msgbox Evaluate(&quot;1 + 2&quot;) 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...
  9. kevinclark

    Running worksheet code/macro when &quot;1 cell's&quot; value is changes

    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(&quot;C2:C6,D5:D6&quot;) If c.Address =...
  10. kevinclark

    execute a subroutine or function via a string

    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(&quot;myadd( &quot; & 2.3 & &quot;, &quot; & 2.3 & &quot;)&quot;) End Sub Hope it helps
  11. kevinclark

    VBA for Excel: Check if cell is in range

    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...
  12. kevinclark

    How to join queries in VBA

    Sorry dkwong if I am still not understanding but could you not just use an &quot;OR&quot; clause in the SQL ? &quot;OR&quot; 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...
  13. kevinclark

    Insert Column with VB &amp; Excel

    'Add reference to Microsoft Excel 9.0 Object Library Private Sub Command1_Click() Dim wbPath As String Set xlApp = CreateObject(&quot;Excel.Application&quot;) xlApp.AskToUpdateLinks = False xlApp.DisplayAlerts = False 'xlApp.Visible = True wbPath =...
  14. kevinclark

    Auto_Close Macro

    Try adding this to you ThisWorkBook module Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim UserPrompt As Long UserPrompt = MsgBox(&quot;Quit ?&quot;, vbQuestion + vbYesNo, &quot;QUIT ?&quot;) If UserPrompt = vbNo Then Cancel = True End...

Part and Inventory Search

Back
Top