Can anybody help me understand how to 'translate' a piece of VB code recorded in Excel into VFP usable code? I have some experience with this, but not as complex as this...
The code below is what I start with... I know that I lose the SUB statement, replace the continuation character (_) with the VFP (;) character, the & with the + etc., but I keep getting a "missing ending )" error.
Where might I look for further guidance on this?
Thanks in advance for any help!
Andrew
Sub QueryTable()
'
' QueryTable Macro
' Macro recorded 22/04/2003 by Andrew Jennings
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=f:\data\tssimms;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;" _
, Destination:=Range("A13"))
.CommandText = Array( _
"SELECT simhisn.line_no, simhisn.batch_no, simhisn.b_l, simhisn.pro_no" & Chr(13) & "" & Chr(10) & "FROM simhisn simhisn" & Chr(13) & "" & Chr(10) & "WHERE (simhisn.batch_no=$485)" & Chr(13) & "" & Chr(10) & "ORDER BY simhisn.line_no" _
)
.Name = "Query from Visual FoxPro Tables"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub
On a CLEAR day you can see forever.