Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-30-2019, 02:04 PM   #1
fosterg100
Newly Registered User
 
Join Date: Nov 2019
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
fosterg100 is on a distinguished road
Button to create new form with same field.

Hi
I am sure this is straightforward, just been going around in circles trying to figure this out.

I have a main form, with the main field being [REFERENCE], with this field being unique.

I just want a button on the main form to open a second form, that has the same field [REFERENCE], which will be a one to many relationship.
I am after the button to add a new record on the second form with the same field [Reference]

Have tried through code and queries, but nothing seems to work.

Can anyone point me in the right direction? Did a few databases a few years back, but this is the first one in a while.

Thanks in advance.
Foster.

fosterg100 is offline   Reply With Quote
Old 11-30-2019, 02:09 PM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,371
Thanks: 13
Thanked 4,120 Times in 4,052 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Button to create new form with same field.

Is this what you're after?

http://www.baldyweb.com/wherecondition.htm
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 11-30-2019, 02:22 PM   #3
fosterg100
Newly Registered User
 
Join Date: Nov 2019
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
fosterg100 is on a distinguished road
Re: Button to create new form with same field.

Hi Paul
Thanks for the reply.
That seems to show the records that match the info in both forms, but I am after the button to open the second form, with the [Reference] field already filed in.
Basically, the second form is a diary form, so will have multiple entries for each [Reference] field.

Sorry, should have made this clear from the start.

Thanks.

fosterg100 is offline   Reply With Quote
Old 11-30-2019, 02:29 PM   #4
fosterg100
Newly Registered User
 
Join Date: Nov 2019
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
fosterg100 is on a distinguished road
Re: Button to create new form with same field.

I have just seen the link, on the link you sent me, apologies, will look at that..
fosterg100 is offline   Reply With Quote
Old 11-30-2019, 02:33 PM   #5
plog
Banishment Pending
 
Join Date: May 2011
Posts: 9,419
Thanks: 11
Thanked 2,285 Times in 2,237 Posts
plog is a jewel in the rough plog is a jewel in the rough plog is a jewel in the rough
Re: Button to create new form with same field.

This really has 2 components--the data part and the form part. You first need to do some data work, then you can open the form correctly.

Lets call the second table and form tblB and frmB respectively:

Data - first you need to run an INSERT INTO query to put a new record in APPEND query to insert tblB. This will have the [REFERENCE] value you need and probably no other data. tblB should have an autonumber primary key ([ID_B]), after you run that query you need to get that value (most likely with a DMAX (https://www.techonthenet.com/access/...omain/dmax.php))

Form - with that [ID_B] value you know what record in tblB you want to open frmB to. You use that in value in the method pbadly provided you.
plog is offline   Reply With Quote
Old 11-30-2019, 02:33 PM   #6
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,371
Thanks: 13
Thanked 4,120 Times in 4,052 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Button to create new form with same field.

You want to enter a new record in the second form? If so, try opening the form and using the argument to open it to a new record, then

Forms!SecondFormName.Reference = Me.Reference
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 11-30-2019, 02:48 PM   #7
fosterg100
Newly Registered User
 
Join Date: Nov 2019
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
fosterg100 is on a distinguished road
Re: Button to create new form with same field.

That's great, all sorted using both you guys help!!!

Thank you very much!

Foster.

fosterg100 is offline   Reply With Quote
Old 11-30-2019, 03:31 PM   #8
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,371
Thanks: 13
Thanked 4,120 Times in 4,052 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Button to create new form with same field.

Glad you got it working.

__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Command Button to select / deselect all in a yes/no field Valery Modules & VBA 15 04-07-2016 02:52 PM
Question How i create a Save Button and A Clear Form Button? Amenofhis General 8 08-16-2012 09:51 AM
Button to create form for certain member ? oMADMANo Forms 17 01-25-2012 03:20 AM
Create .Txt File With field data on command button event CharlesWhiteman Modules & VBA 3 06-13-2007 06:35 AM
Create new table & form from button johnnyb Modules & VBA 2 11-15-2004 04:06 AM




All times are GMT -8. The time now is 05:29 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World