Hello everybody:
I am inserting a string resulting from a record set loop into an unbound text box. However, I am unable to align the text (column headings) with the rs results.
The record set code and the string assignment follow:
Set db = CurrentDb
sql = "SELECT tblWorkOrder.WOID, tblWorkOrder.SerialNo, tblWorkOrder.PartNumber, "
sql = sql & "tblWorkOrder.machine_req_drwg_num FROM tblWorkOrder WHERE WOID = " & Me.WOID
Set rs = db.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges)
serialCount = 0
serialStr = ""
If rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF
serialCount = serialCount + 1
serialStr = serialStr & "Work Order#" & " / " "Serial#" & " / " & "Part#" & " / " & "Drawing#" & " / " & vbCrLf
serialStr = serialStr & rs.Fields("WOID")& " / " & rs.Fields("SerialNo") & " / " & rs.Fields("PartNumber") & " / " & rs.Fields("machine_req_drwg_num") & vbCrLf & vbCrLf
rs.MoveNext
Loop
db.Close
I have tried to separate the fields with 'space()', 'vbTab', and '" "' to no avail. I have finally just separated the values using manual spaces and '/'. When I tried using vbTab, a small square is inserted between the fields.
Is there a way to align the field results with each other and the text I am using as my column headers as if they were in separate columns?
I know that I can set the position of a text box adjusting the position (# of twips), but I don't know if I can set width for a field inside of a string. Also, I cannot get the column headings to stop repeating.
One last thing -- is there a list of VBA functions or shortcuts, I guess like vbCrLf, vb...? I am not sure what these are called so I am unable to look them up.
I really appreciate any help you all can provide.
I am inserting a string resulting from a record set loop into an unbound text box. However, I am unable to align the text (column headings) with the rs results.
The record set code and the string assignment follow:
Set db = CurrentDb
sql = "SELECT tblWorkOrder.WOID, tblWorkOrder.SerialNo, tblWorkOrder.PartNumber, "
sql = sql & "tblWorkOrder.machine_req_drwg_num FROM tblWorkOrder WHERE WOID = " & Me.WOID
Set rs = db.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges)
serialCount = 0
serialStr = ""
If rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF
serialCount = serialCount + 1
serialStr = serialStr & "Work Order#" & " / " "Serial#" & " / " & "Part#" & " / " & "Drawing#" & " / " & vbCrLf
serialStr = serialStr & rs.Fields("WOID")& " / " & rs.Fields("SerialNo") & " / " & rs.Fields("PartNumber") & " / " & rs.Fields("machine_req_drwg_num") & vbCrLf & vbCrLf
rs.MoveNext
Loop
db.Close
I have tried to separate the fields with 'space()', 'vbTab', and '" "' to no avail. I have finally just separated the values using manual spaces and '/'. When I tried using vbTab, a small square is inserted between the fields.
Is there a way to align the field results with each other and the text I am using as my column headers as if they were in separate columns?
I know that I can set the position of a text box adjusting the position (# of twips), but I don't know if I can set width for a field inside of a string. Also, I cannot get the column headings to stop repeating.
One last thing -- is there a list of VBA functions or shortcuts, I guess like vbCrLf, vb...? I am not sure what these are called so I am unable to look them up.
I really appreciate any help you all can provide.