Filter Access Report in VB

O'Bina 1 Reputation point
2021-08-23T05:33:58.48+00:00

Hi All,
The below command works pretty well:
DoCmd.OpenReport "Project HSE Management Report", acViewReport, , "[ProjectID] = '002'"

Unfortunately, when I replace the '002' with the actual Form Control (see below), it crashes!!!!

DoCmd.OpenReport "Project HSE Management Report", acViewReport, , "[ProjectID] =" & Me.ProjectID

What could be the problem?

The form is called PROJECTS and sits on a Navigation Control called NAVIGATION PAGE.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,448 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 114.7K Reputation points
    2021-08-23T08:40:46.137+00:00

    If Me.ProjectID is "002", then try this line:

    DoCmd.OpenReport "Project HSE Management Report", acViewReport, , "[ProjectID] = '" & Me.ProjectID & "'"

    0 comments No comments