Problem in Serialized Function

mubi_masti

Registered User.
Local time
Tomorrow, 03:11
Joined
Oct 2, 2011
Messages
46
hello

any body can help me, i am really stuck in this problem

I have two tables both are linked,
i have develop three queries, one query for sub form, while two other queries filter the data. In both queries i have used serialized function developed by ""

THis function works fine when no field is refered to a controlsource of a form but when any field is refered to any controlsource of a form then an error occur

the error is always common and it is about

rs.close (mention in a serialized function)

for your information i m attaching the file.
please help me out.
 

Attachments

It would help clarify your issue if you could describe what it is you are trying to do.
 
Serialized is an OOP concept and there's no Serialized interface in VBA as you would have in Java (for example). I'm guessing you've copied some code from somewhere.
 
Following is the function which is called in a query. If there no field which is referring a text box of a form then this function returns a serial number
but it shows an error if any field is referring text field of a form:

look at the following two queries:

Query 1 (works fine)

SELECT Serialized("Copy of session Timing","Std_ID",[Std_ID]) AS RowNum, Session.Prest_date, Session.Std_ID, Session.Name, Session.Time_session
FROM [Session]
ORDER BY Session.Prest_date;

Query 2;( produce an error)

SELECT Serialized("session timing","Std_ID",[Std_ID]) AS RowNum, Session.Prest_date, Session.Std_ID, Session.Name, Session.Time_session
FROM [Session]
WHERE (((Session.Prest_date)=[forms]![session timing]![session_date]) AND ((Session.Result)="No Result Declared"))
ORDER BY Session.Prest_date;

I think it will explain what i want to do: Please provide solution if you can........


Function Serialized(qryname As String, keyname As String, keyvalue) As Long
Dim rs As Recordset

On Error GoTo Err_Serialized
Set rs = CurrentDb.OpenRecordset(qryname, dbOpenDynaset, dbReadOnly)
rs.FindFirst Application.BuildCriteria(keyname, rs.Fields(keyname).Type, keyvalue)
Serialized = Nz(rs.AbsolutePosition, -1) + 1

Err_Serialized:
rs.Close
Set rs = Nothing
End Function
 
I don't think you understand what parameters you should be giving your function. The third parameter requires a criteria, this is what BuildCriteria uses. I suggest you re-think your approach or go back and read the description of the function from where you copied it from.
 

Users who are viewing this thread

Back
Top Bottom