Solved RUN-TIME ERROR '2467':

Buster Aldrich

New member
Local time
Today, 07:20
Joined
Apr 5, 2020
Messages
6
I am trying to open a form in access 2007 Frm_LabelToPrint_Config and check for any records.
The code will then take actions if there are records.
Other actions if the recordset is empty.
The form is bound to a table Tbl_LabelsToPrint_Config

Here is the code for this
DoCmd.OpenForm "Frm_LabelsToPrint_Config"
If DCount("*", [Frm_LabelsToPrint_Config].RecordSource) > 0 Then

and a series of actions

The form is opening and there are records as per the attached pdf.
The debug shows the line
If DCount("*", [Frm_LabelsToPrint_Config].RecordSource) > 0 Then
as the culprit.

I'm sure that it is an easy answer and I have always found it is me and not Access making the mistake.
Any advice would be greatly appreciated.
 

Attachments

Hi. What the PDF doesn't show is what is in the Record Source property of the form. If it's a table or query name, you could try it this way:

If DCount("*",Forms!Frm_LabelsToPrint_Config.RecordSource) > 0 Then

But no guarantees though...
 
My guess is DCount is treating your Form reference as a table/query and it doesn't exist as such.

I am trying to open a form in access 2007 Frm_LabelToPrint_Config and check for any records.
...
The form is bound to a table Tbl_LabelsToPrint_Config

Cut out the middle man, no need to open the form. Do the DCount directly on Tbl_LabelsToPrint_Config
 
ABSOLUTELY!!! Not sure why yet but I'll look at the whys after I figure out the next error further down.
 

Users who are viewing this thread

Back
Top Bottom