VBA to Open Form With Custom Query

  • Thread starter Thread starter ghadley_00
  • Start date Start date
G

ghadley_00

Hi,

I have an MS access database form that during creation of a new entry
checks to see if that entry already exists in a table (using code
triggered as part of the afterupdate event).

At present a message box is triggered, however, I would like to have a
second form open with it's data source being a query for all the
records that have the matching field (e.g. Name).

Is there a way to open an existing form and define its data source via
VBA?

Thanks,

George Hadley
(e-mail address removed)
 
Hi,

I have an MS access database form that during creation of a new entry
checks to see if that entry already exists in a table (using code
triggered as part of the afterupdate event).

At present a message box is triggered, however, I would like to have a
second form open with it's data source being a query for all the
records that have the matching field (e.g. Name).

Is there a way to open an existing form and define its data source via
VBA?

Sounds like all you need to do is open the form with an appropriate WHERE
clause. That ability is built right into the OpenForm method and there is even
a wizard that will write the code for you.
 
Back
Top