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

Search results for query: *

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

    How to join queries in VBA

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

    Format date by Export Data from Access to Excel

    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), &quot;Short Date&quot;) or the following line after the line above .Cells(1, i + 2).NumberFormat = &quot;mm/dd/yyyy&quot; Hope it helps
  17. kevinclark

    Loop through objects in Excel

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

    Loop through objects in Excel

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

    Repeat Code To Next ows Containing Data

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

Part and Inventory Search

Back
Top