473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Open Form with data source as custom query via VBA

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
gh********@yahoo.com

Mar 19 '06 #1
2 8564
On 19 Mar 2006 05:45:15 -0800, gh********@yahoo.com wrote:
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
gh********@yahoo.com


DoCmd.OpenForm "frmMyForm"
Forms!frmMyForm.RecordSource = "qryMyQuery"
Wayne Gillespie
Gosford NSW Australia
Mar 19 '06 #2
On 19 Mar 2006 05:45:15 -0800, gh********@yahoo.com wrote:

Yes. Study "DoCmd.OpenForm" in the help file. You'll find a
WhereClause argument that you can set to your criteria, e.g.
"PersonID=" & Me.PersonID

-Tom.
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
gh********@yahoo.com


Mar 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Unigroup of New York | last post by:
Content-Type: multipart/mixed; boundary="------------C465DF38DCB38DD2AF7117E0" Lines: 327 Date: Tue, 15 Feb 2005 23:36:38 -0500 NNTP-Posting-Host: 24.46.113.251 X-Complaints-To: abuse@cv.net...
2
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out...
5
by: Ryan Hubbard | last post by:
Is it possible to get the recordset from an open query window? So you run the query. The window is open. Can vba retrieve this data?
2
by: JM | last post by:
Hi I have been trying to open Excel 2003 but I am having rotten luck. Just can't see to get it working. I looked at this article... ...
3
by: doncee | last post by:
Not an expert but have a paramater query that would like to open as a list box on an existing form. I have a button which opens the query from the form right now but would like to have it open as...
5
by: BD | last post by:
I am coding with C# in Visual Studio 2005 for a database application residing on remote MS SQL Server 2005. What I want to do is open the same form but from 2 different places and only one...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
7
kcdoell
by: kcdoell | last post by:
Hello: I have a form that I want to open using a filter that I have created. I have done this usually by pointing the record source of the form to the query/filter that I created. In this new...
1
by: ErikJL | last post by:
I have a simple webservice that performs a SELECT query against a database, and then an INSERT statement on the same database/table. The problem arises at the time when we create the second OleDB...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.