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 Chriss Miller 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 combo

  1. combo

    Query expression negative to a 0

    I agree that UDF is the best tool to structure conditions. For simple calculations I frequently use: Function Max2(Val1 As Double, Val2 As Double) As Double If Val1 > Val2 Then Max2 = Val1 Else Max2 = Val2 End Function I would also check if your formula is proper. In: IIf(...
  2. combo

    Convert PDF file to text

    In Word VBA: Sub test() Dim wdDoc As Document Application.DisplayAlerts = wdAlertsNone Set wdDoc = Documents.Open(FileName:="PathAndFileName.pdf", AddToRecentFiles:=False) wdDoc.SaveAs2 FileName:="PathAndFileName.txt", FileFormat:=wdFormatText, AddToRecentFiles:=False wdDoc.Close...
  3. combo

    Printer.Print to PDF

    Using Office VBA code makes sense in case of automating one of Office applications. They use internal configurable converters for generating pdfs. Excel, Word and PowerPoint use document's ExportAsFixedFormat method (PowerPoint has two additional variants), Access DoCmd.OutputTo method...
  4. combo

    Power Query Split by Table Group by Rows into a new set of group by tables

    You can add subindex to each 'Face List Table' tables, expand, split subindex to GroupID, group again using GroupID (if grouping is necessary. An example with two tables: 1. 'query1': x1 100 (unique values) 20 ... 2. 'query2' (related table): x2 (related to 'x1'0 y 100 val1 100...
  5. combo

    Problem with Excel pasting into filtered cells

    It's just an Excel feature, hidden rows have still data and can be referenced in other cells. It seems that Excel copies visible cells. There are possibilities (copy & paste in filtered range): single cell copied, single cell selected to paste: trivial, single cell copied, range selected...
  6. combo

    SQL data types in CREATE/ALTER TABLE queries

    Thanks, it seems that there is a total mess here. I tested some types, my observations: Access will not save query with not recognized field type, a direct answer to my post: simple BIGINT and DATETIME2 work! TINYINT is not recognized, BYTE works, TEXT and LONGTEXT create text and long text...
  7. combo

    SQL data types in CREATE/ALTER TABLE queries

    I found a list a list of Access SQL data types from MS here. However, this article refers to Access 2013. In the meantime Access introduced large number and extended datetime fields handling. Is it possible to generate new types fields with access query, if so - what type names should be used?
  8. combo

    Calculate amt due

    With a layout as in the workbook, IMHO the only way is to manually arrange output. If it is possible to rearrange data, I would use: column example/remarks CustID C004200 Name Cusomer #4 SettlementID #1, #2, ... Type Settlement, collection Amount use negative in one of types (for...
  9. combo

    Open Word as ReadOnly

    Actually, Word may repaginate document for different printer, update fields or styles. NB, read-only document can be changed, next saved, but only with different name. Another option to close changed document without saving: wdDoc.Saved = True wdDoc.Close
  10. combo

    Help with a Query.

    If your data is a copy from pivot table report and both Code and Serial are in row area, you can format set pivot table field (in this case code) to repeat labels - no need to fill field with empty entries.
  11. combo

    Hyperlinks in Word cut at #

    The rest is in subaddress. Sub test() Dim wdDoc As Word.Document Dim oLink As Word.Hyperlink Set wdDoc = ThisDocument Set oLink = wdDoc.Hyperlinks(1) 1 Debug.Print oLink.Address & "#" & oLink.SubAddress 2 Debug.Print oLink.TextToDisplay 3 Debug.Print oLink.Name End Sub In (1): I guessed the...
  12. combo

    Excel formula to count occurrences of a value in a different sheet

    A little shorter formula with SUMPRODUCT: =SUMPRODUCT((YEAR('Sheet 2'!A6:A999)=2024)*1)
  13. combo

    Crazy question: Can anyone help me create a routine to roll 2 dice 1000x and sum them?

    Problem solved, so it's just an idea to complete the task with queries only: 1. create a table [T10] with field [V], values 1 to 10, 2. query: SELECT 100*[T10_2].[V]+10*[T10_1].[V]+[T10].[V]+1 AS ID, Int(Rnd(2*[ID]-1+Timer())*6)+1 AS Dice1, Int(Rnd(2*[ID]+Timer())*6)+1 AS Dice2 FROM T10, T10 AS...
  14. combo

    Having trouble with Excel Lookup

    Why array function in S3? Try regular one.
  15. combo

    Excel macro to send e-mail to multiple agents with a different body for each

    To make referencing easier i would either pick data from range to variant array (vData=rngData) or reference range cells by indexes: Dim rngData As Range Dim iRngRows As Integer, i As Integer Dim sHTMLBody As String Set rngData = Worksheets(1).Range("A1").CurrentRegion ' if no other data next to...

Part and Inventory Search

Back
Top