A
Anthony Viscomi
I have the following:
Function RunUpdate()
DoCmd.SetWarnings False
Dim dbCurr As DAO.Database
Dim qdfCurr As DAO.QueryDef
Dim qdf As QueryDef
Dim sSQL As String
Dim db As Database
Dim prmSupplier As Parameter
Dim rs As Recordset
sSQL = "SELECT [Vendor].*"
sSQL = sSQL & " FROM [Vendor];"
Set db = CurrentDb()
Set rs = db.OpenRecordset(sSQL, dbOpenDynaset)
With rs
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
For Each qdfCurr In db.QueryDefs
If InStr(qdfCurr.Name, "849 Pull Vendor") = 1 Then
If qdfCurr.Name = "849 Pull Vendor 100 Build NE 0" Then
Set qdfCurr = db.QueryDefs("849 Pull Vendor 100 Build NE
0")
Set prmSupplier = qdfCurr.Parameters![Supplier]
prmSupplier = Fields(1).Value
qdfCurr.Execute
Else
DoCmd.OpenQuery qdfCurr.Name
End If
End If
Next qdfCurr
.MoveNext
Loop
End If
End With
rs.Close
Set rs = Nothing
End Function
I keep receiving the "Sub or Function not defined error" for the Fields in
the line:
prmSupplier = Fields(1).Value
I received this function from a co-worker and it runs fine on his machine;
any thoughts?
Thanks!
Anthony
Function RunUpdate()
DoCmd.SetWarnings False
Dim dbCurr As DAO.Database
Dim qdfCurr As DAO.QueryDef
Dim qdf As QueryDef
Dim sSQL As String
Dim db As Database
Dim prmSupplier As Parameter
Dim rs As Recordset
sSQL = "SELECT [Vendor].*"
sSQL = sSQL & " FROM [Vendor];"
Set db = CurrentDb()
Set rs = db.OpenRecordset(sSQL, dbOpenDynaset)
With rs
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
For Each qdfCurr In db.QueryDefs
If InStr(qdfCurr.Name, "849 Pull Vendor") = 1 Then
If qdfCurr.Name = "849 Pull Vendor 100 Build NE 0" Then
Set qdfCurr = db.QueryDefs("849 Pull Vendor 100 Build NE
0")
Set prmSupplier = qdfCurr.Parameters![Supplier]
prmSupplier = Fields(1).Value
qdfCurr.Execute
Else
DoCmd.OpenQuery qdfCurr.Name
End If
End If
Next qdfCurr
.MoveNext
Loop
End If
End With
rs.Close
Set rs = Nothing
End Function
I keep receiving the "Sub or Function not defined error" for the Fields in
the line:
prmSupplier = Fields(1).Value
I received this function from a co-worker and it runs fine on his machine;
any thoughts?
Thanks!
Anthony