Hello everyone,
I am new here, but here is my issue. I am running a model through an outside program. The final results sheet spits into Excel. I keep geting a runtime error 429. When I choose to debug, this is what it points to:
Function GetCompanyName( DB As String, co_code As String) As String
Dim SQL$
Dim rs_CoName As Recordset
---> Set hmws = DBEngine.Worksp aces(0)
Set hmdb = hmws.OpenDataba se(DB, False, True)
SQL$ = "select company_name from company where neca_id = '" & co_code & "'"
Set rs_CoName = hmdb.OpenRecord set(SQL$, dbOpenSnapshot)
If Not (rs_CoName.EOF And rs_CoName.BOF) Then
rs_CoName.MoveF irst
GetCompanyName = rs_CoName.Field s(0)
Else
GetCompanyName = "Unknown"
End If
rs_CoName.Close
Set rs_CoName = Nothing
End Function
Where i inserted the error is where I am having the problem. Does anyone know what the problem is and how to fix it? My boss is breathing down my neck.
I am new here, but here is my issue. I am running a model through an outside program. The final results sheet spits into Excel. I keep geting a runtime error 429. When I choose to debug, this is what it points to:
Function GetCompanyName( DB As String, co_code As String) As String
Dim SQL$
Dim rs_CoName As Recordset
---> Set hmws = DBEngine.Worksp aces(0)
Set hmdb = hmws.OpenDataba se(DB, False, True)
SQL$ = "select company_name from company where neca_id = '" & co_code & "'"
Set rs_CoName = hmdb.OpenRecord set(SQL$, dbOpenSnapshot)
If Not (rs_CoName.EOF And rs_CoName.BOF) Then
rs_CoName.MoveF irst
GetCompanyName = rs_CoName.Field s(0)
Else
GetCompanyName = "Unknown"
End If
rs_CoName.Close
Set rs_CoName = Nothing
End Function
Where i inserted the error is where I am having the problem. Does anyone know what the problem is and how to fix it? My boss is breathing down my neck.