Solved RUN-TIME ERROR '2467': (1 Viewer)

Buster Aldrich

New member
Local time
Today, 05:22
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

  • run-time error 2647.pdf
    278.5 KB · Views: 107

theDBguy

I’m here to help
Staff member
Local time
Today, 03:22
Joined
Oct 29, 2018
Messages
21,358
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...
 

Buster Aldrich

New member
Local time
Today, 05:22
Joined
Apr 5, 2020
Messages
6
The form is bound to a table Tbl_LabelsToPrint_Config
 

Attachments

  • Frm_LabelsToPrint_Config.pdf
    317.7 KB · Views: 96

plog

Banishment Pending
Local time
Today, 05:22
Joined
May 11, 2011
Messages
11,613
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
 

Buster Aldrich

New member
Local time
Today, 05:22
Joined
Apr 5, 2020
Messages
6
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

Top Bottom