trickshot1126
Technical User
Hello,
I have code that i have written that searches through a tables fields and copies that which is not null. It is working beautifully except for one thing. I do not, for any reason with this code, to copy fields 0 - 9. Those fields are only included in the form for future reporting purposes within the database.
The following is my code:
Sub copytoVehChgtoCCP()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qDef As DAO.TableDef
Dim fld As DAO.Field
Dim RowData As String
Dim x As Integer
Set db = CurrentDb()
Set qDef = db.TableDefs("tblTable1")
Set rs = qDef.OpenRecordset
RowData = ""
For Each fld In rs.Fields
If Not fld.Name = field1 Or field2 Then
If fld.Value <> "" Then
RowData = RowData & fld.Name & ": " & fld.Value & vbNewLine
End If
End If
Next fld
ClipBoard_SetText (RowData)
pasteContent (RowData)
End Sub
This code works up until I include the If Not fld.name = TS or NI1 then...
Ideas?
With out that specific if it works and copies all the fields in the table as needed.
Thanks for the help!
Rob
I have code that i have written that searches through a tables fields and copies that which is not null. It is working beautifully except for one thing. I do not, for any reason with this code, to copy fields 0 - 9. Those fields are only included in the form for future reporting purposes within the database.
The following is my code:
Sub copytoVehChgtoCCP()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qDef As DAO.TableDef
Dim fld As DAO.Field
Dim RowData As String
Dim x As Integer
Set db = CurrentDb()
Set qDef = db.TableDefs("tblTable1")
Set rs = qDef.OpenRecordset
RowData = ""
For Each fld In rs.Fields
If Not fld.Name = field1 Or field2 Then
If fld.Value <> "" Then
RowData = RowData & fld.Name & ": " & fld.Value & vbNewLine
End If
End If
Next fld
ClipBoard_SetText (RowData)
pasteContent (RowData)
End Sub
This code works up until I include the If Not fld.name = TS or NI1 then...
Ideas?
With out that specific if it works and copies all the fields in the table as needed.
Thanks for the help!
Rob