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