Recordset issue

Steve2106

New member
Local time
Today, 15:30
Joined
Oct 7, 2013
Messages
8
Hi There,

I am trying to find an issue in an access program but I do not know why there is a problem. I have narrowed it down to this piece of code:
If (Not IsNull(Me.Recordset("TaskId"))) And Me.Recordset("TaskId") <> 0 Then
there is a value in TaskId
Else
there is not a value in TaskId
End If

What is Me.Recordset("TaskId") and where would it have been created?
The program breaks if there is no value for TaskId. I can't find where the recordset is first created.

Thanks for your help.

Best Regards,
 
Who wrote the program?
Where is this code located?

We need more info on your "issue".
 
From that syntax, "Me" refers to a form or report. The properties of the form or report will include a .Recordsource to provide data for said object. When that object is opened, the .Recordsource is OPENED as a recordset, which can then be accessed as Me.Recordset. The ("TaskID") in that context suggests that TaskID is a field in the .Recordsource that gets opened when the bound form gets opened.
 
Hi there,
The programmer is no longer available and I have been asked to have a look at the code to see if I can help.
This bit of code is in the form open event and I am trying to find where Me.Recordset("TaskId") is initiated or created.
Thanks for any help.

Best Regards,
 
Look at the form in design view. Go to its properties and see what is being used as Recordsource.

As Doc said "... TaskID is a field in the .Recordsource that gets opened when the bound form gets opened. "
 
Steve,

This is a very basic concept related to the primary behavior of Access forms. You need to understand bound forms. If you don't, this problem might not be something you are ready to address without more study. (No disrespect intended; I'm just telling you what tools need to be in your mental toolbox.)

A bound form is fed its data by a recordset that is part of the form's properties - more specifically, the .Recordsource property. When you open the form, the .Recordsource is used to open a recordset (as part of the Form_Open sequence).

The syntax of that statement tells me that TaskID must be a field in the recordset bound to the form or report.

This is such basic stuff that I don't know if I can say it more clearly than that.
 
Hi there,
Thanks for the help.
Doc-Man no offence taken, thanks for sharing.

I'll have another look and see if I can get any further.

Thanks again.

Best Regards,
 

Users who are viewing this thread

Back
Top Bottom