اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

Option Compare Database

Function RcNumQ1(mID As Variant, fldName As String) As Variant
Dim RstClone As Recordset
Dim Fld As Field
Dim i As Long
RcNumQ1 = Null
If IsNull(mID) Then Exit Function
Set RstClone = CurrentDb.QueryDefs("name of query").OpenRecordset
If RstClone.RecordCount = 0 Then Exit Function
Set Fld = RstClone.Fields(fldName)
With RstClone
.MoveFirst
Do Until .EOF
i = i + 1
If Fld = mID Then Exit Do
.MoveNext
Loop
End With
RstClone.Close
RcNumQ1 = i
End Function

 

 

قام بنشر

وعليكم السلام ..جرب واعلمنا النتيجة

خذ بالك من ال parameter

Public Function RcNumQ1(mID As Variant, fldName As String, MyQuery As QueryDef) As Variant
Dim RstClone As Recordset
Dim Fld As Field
Dim i As Long
RcNumQ1 = Null
If IsNull(mID) Then Exit Function
Set RstClone = CurrentDb.QueryDefs("MyQuery").OpenRecordset
If RstClone.RecordCount = 0 Then Exit Function
Set Fld = RstClone.Fields(fldName)
With RstClone
.MoveFirst
Do Until .EOF
i = i + 1
If Fld = mID Then Exit Do
.MoveNext
Loop
End With
RstClone.Close
RcNumQ1 = i
End Function

 

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information