Sorry to trouble you again. Now Am getting the following error
Run time error 3061: too few parameters expected2.
Here is a sample of the code. I don't understand why the values are not getting passed into the function.
Public Sub Input_mas_tag(tmas_tag As String, tmas_tag1 As String)
Dim acad_txt_ent As Object
Dim rec As Recordset
Dim st As String
Dim col As Integer, row As Integer, count As Integer
Dim main_values As Variant
UserForm1.Hide
st = "select * from TAG_MASTER where ITAG = tmas_tag And STG1 = tmas_tag1"
' st = "select * from TAG_MASTER where ITAG = " + Chr(34) + tmas_tag + Chr(34) And STG1 = " + Chr(34) + tmas_tag1 + Chr(34)"
' st = "select * from TAG_MASTER where ITAG = " + Chr(34) + tmas_tag + Chr(34) + ";"
Set rec = db.OpenRecordset(st)
If rec.BOF = False Then
main_values = rec.GetRows(rec.RecordCount)
For Each acad_txt_ent In ThisDrawing.ModelSpace
If acad_txt_ent.EntityName = "AcDbText" Then
For count = 0 To UBound(main_values, 1) Step 1
If acad_txt_ent.TextString = rec.Fields(count).SourceField Then
If IsNull(main_values(count, 0)) = False Then
acad_txt_ent.TextString = main_values(count, 0)
Else
acad_txt_ent.TextString = "-"
End If
acad_txt_ent.Update
Exit For
End If
Next count
End If
Next
Else
MsgBox "no record found", vbOKOnly
End If
End Sub
Sorry. Still without a solution and getting the same error message too few parameters expected2 even after trying CALL before the function name and enclosing the parameters within (). I tried
st = "select * from TAG_MASTER where ITAG = tmas_tag And STG1 = tmas_tag1"
So:
st = "select * from TAG_MASTER where ITAG = '" & tmas_tag & "' And STG1 = '" & tmas_tag1 & "'"
Remove the single quotes if the fields are not text fields, but number fields instead
To catch an error like this it helps to put an error handler right inside the proceedure. Then you will see where the error is actually occuring - I suspect on the line:
Set rec = db.OpenRecordset(st)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.