I use a Select SQL statment to get the details to build a table in a word document that I output from a form. The SQl statement is based on a query. I need to concatenate 6 fields together and add hyphens between the fields. I have it all except the punctuation working.
My code as follows:
'BIT TABLE
'Get details from DB and create a table in the document
'Build SQL string for bit details
strSQL1 = "SELECT [Bit].[Bit No] as [Bit No], [Bit].[Bit Size] as [Size]," & _
"[Bit].[Bit Mfgr] as [Mfg], [Bit].[Bit Type] as [Type], [Bit].[Bit Serial No]" & _
"as [Ser No], Nozzle1 & Nozzle2 & Nozzle3 & Nozzle4 & Nozzle5 & Nozzle6 as [Nozzles]," & _
"[Bit].[DepthIn] as [In], [DepthOut] as [Out], [CumHrs] as Hours," & _
"[CumFtg] as Footage, Round(([CumFtg]/[CumHrs]),1) " & _
"as ROP from [qryDailyBitRuns] WHERE [Bit].[DayID] =" & [Forms]![frmDay]![Status].[Form]![DayID]
'Get details from database and create a table
'in the document
Set rst1 = dbs.OpenRecordset(strSQL1, dbOpenSnapshot)
colCount = 11
With CreateTableFromRecordset(objWord.ActiveDocument.Bookmarks("Details"
.Range, rst1, colCount, True)
I am concatenating Nozzle1 & Nozzle2 & ... as Nozzle, but I want a hyphen between each Nozzle, so instead of 121212000, I get 12-12-12-0-0-0.
I've tried Nozzle1 & "-" & Nozzle2 & ...
Any help is appreciated.
Thanks in advance
BusMgr
My code as follows:
'BIT TABLE
'Get details from DB and create a table in the document
'Build SQL string for bit details
strSQL1 = "SELECT [Bit].[Bit No] as [Bit No], [Bit].[Bit Size] as [Size]," & _
"[Bit].[Bit Mfgr] as [Mfg], [Bit].[Bit Type] as [Type], [Bit].[Bit Serial No]" & _
"as [Ser No], Nozzle1 & Nozzle2 & Nozzle3 & Nozzle4 & Nozzle5 & Nozzle6 as [Nozzles]," & _
"[Bit].[DepthIn] as [In], [DepthOut] as [Out], [CumHrs] as Hours," & _
"[CumFtg] as Footage, Round(([CumFtg]/[CumHrs]),1) " & _
"as ROP from [qryDailyBitRuns] WHERE [Bit].[DayID] =" & [Forms]![frmDay]![Status].[Form]![DayID]
'Get details from database and create a table
'in the document
Set rst1 = dbs.OpenRecordset(strSQL1, dbOpenSnapshot)
colCount = 11
With CreateTableFromRecordset(objWord.ActiveDocument.Bookmarks("Details"
I am concatenating Nozzle1 & Nozzle2 & ... as Nozzle, but I want a hyphen between each Nozzle, so instead of 121212000, I get 12-12-12-0-0-0.
I've tried Nozzle1 & "-" & Nozzle2 & ...
Any help is appreciated.
Thanks in advance
BusMgr