Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 06:12 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Forcing a new rec in a subform from a diff form

Ciao!

(Access 97 Prob)

Backgorund:
I have a main form "Form A" with a subform "Form A1".
The subform allows users to add Candidates for a certain test.
I have allowed a button on "Form A" that will show a new form "Form Z" that lits all Candidates already in the db.
The idea is that when a user chooses a Candidate from "Form Z" (and clicks a button) it should populate the subform "Form A1". - All this I can do.

Problem
I need to force a new record on the subform "Form A1" just before I pass the Candidates details from "Form Z".
Otherwise if the cursor is left on any rec in subform "Form A1" it is overwritten by the details from "Form Z".

Any ideas are absolutely welcome!!
 
Old September 15th, 2004, 10:13 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post
Default

DrSnuggles,

Let me ask you a few questions to understand your problem better.
1) Form A - what is the name of the table. (ex. tbl_A)
2) Subform A - same question. (ex. tbl_A1)
3) Form Z - same question. (ex. tbl_Z)
4) You mentioned when you click a button in form A, it will open a
Form Z to add a new record. And when the new record is added it will
automatically add a new record in Subform A. Do I understand it right?

The idea I have in mind is to create an event function to every
control in access forms. For example when you add a record in Form Z (tbl_Z), first it will search if there is an existing record in (tbl_A1) Subform A.
If Yes - it will update it, otherwise/No - it will insert a new record in tbl_A1.

The event function will be an ADODB recordset function filed under Modules. Most of my user defined event functions (such as OnClick, OnOpen, AfterUpdate, etc.) are in one place so it will be reusable in other forms.

Also, based on my experience, when I have user-defined functions in a form,I donot have a subform in it for the reason to easily identify
the table-relationships.

Let me know if this could work for you.
John











Similar Threads
Thread Thread Starter Forum Replies Last Post
Regd: Issues with designing text diff form gk_sezhian C# 1 May 11th, 2008 11:30 AM
How to? Copy rec to new tbl then del old rec LearningACCESS Access VBA 13 March 6th, 2007 11:56 AM
form/subform problem chacquard Access VBA 1 November 21st, 2006 06:50 PM
set form on subform gigi79 Access 2 May 23rd, 2006 03:08 PM
Forcing a form in the parent's parent to submit Snib Javascript 11 June 22nd, 2004 11:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.