473,847 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using a button to populate another form's auto# field.

I'm not certain if this made the post. Sorry if it's a repeat:

Using a Button to take an autonumber from one form to populate another
autonumber field on another form.

I have a Mainform "A" with a button and code that opens another Mainform
"B"
with a subform which has the same table as Mainform "A".

The button is supposed to tell the subform with the autonumber field
that
whatever appears there should be the same number In Mainform A.

How do I add code to my button, that opens Mainform B, and reach down
and
link to the its subform with the same populated autonumber field ?

This is the Open Form button code that I am using:

Private Sub Command116_Clic k()
On Error GoTo err_Command116_ click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunComman d acCmdSaveRecord

stDocName = "frmMain"
stLinkCriteria = "[txtGuestID]=" & Me![GuestID] 'BOTH ARE AUTONUMBER
FIELDS
DoCmd.OpenForm stDocName, , , stLinkCriteria
exit_Command116 _click:
Exit Sub
err_Command116_ click:
'MsgBox "Type/Select a 'Entry's Name', before clicking on
'Registration'. "
Resume exit_Command116 _click
End Sub

John

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
1 3685
I must admit that I didn't finish reading your post to the end, because
the premise is not possible.

You can populate a NON-AUTONUMBER field on Form B with the autonumber
generated on Form A or you can Populate Form B with it's own Autonumber
when an Autonumber is generated on Form A but you can't synchronize two
Autonumbers in two different tables. That's the nature of Autonumbers ...
you cannot tell the table what they should be.

If you have your schema set up correctly, then you simply use a form-subform
arrangement where the LinkMaster and LinkChild properties are assigned to the
primary key of the master form ... like this ...

Form/Table: tblOrder with primary key of OrderID
Form/Table: tblOrderDetail with primary key of OrderDetailID
and foreign key of OrderID

Create a master form for Order and a subform for Order detail. Embed the
subform on the master form and set the LinkMaster and LinkChild properties
to OrderID. The population of the subform OrderID will be automatic, as will
the population of OrderDetailID if it's an Autonumber.
--

Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com/datafast/

"John Phelan-Cummings" <jp*********@ho tmail.com> wrote in message news:3F******** *****@news.uswe st.net...
I'm not certain if this made the post. Sorry if it's a repeat:

Using a Button to take an autonumber from one form to populate another
autonumber field on another form.

I have a Mainform "A" with a button and code that opens another Mainform
"B"
with a subform which has the same table as Mainform "A".

The button is supposed to tell the subform with the autonumber field
that
whatever appears there should be the same number In Mainform A.

How do I add code to my button, that opens Mainform B, and reach down
and
link to the its subform with the same populated autonumber field ?

This is the Open Form button code that I am using:

Private Sub Command116_Clic k()
On Error GoTo err_Command116_ click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.RunComman d acCmdSaveRecord

stDocName = "frmMain"
stLinkCriteria = "[txtGuestID]=" & Me![GuestID] 'BOTH ARE AUTONUMBER
FIELDS
DoCmd.OpenForm stDocName, , , stLinkCriteria
exit_Command116 _click:
Exit Sub
err_Command116_ click:
'MsgBox "Type/Select a 'Entry's Name', before clicking on
'Registration'. "
Resume exit_Command116 _click
End Sub

John

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #2

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

Similar topics

5
2101
by: Mike Dee | last post by:
Is it possible to dynamically create a new form object (form1), then create a new form field object and add it form1, and then add form1 to the current document? I need to do all this in script rather than using the html <form> and related tags. Can this be done to support both IE, Firefox? Any code snippets or samples showing how to do this would be fantastic. Thanks! --- Mike
7
3830
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a database search that I am unable to figure out how to access. (The search is implemented in Php/MySQL.) The user enters search values for: name, address1, city, .... etc., ..... and for each of these they also select whether the search should...
11
3245
by: alphaomega3 | last post by:
I have a form called frmIlogEntry. this form is based on the table tblILOG. I have a fields in the table and on the form VendNo and VendName. On the form I want when the user types in the VendNo the field VendName to auto-populate. I am sure this is probably an easy function but for the life of me I can't get it. VendNo and VendName are stored in tblVendors. Please help....AO3
10
2626
by: BNicholeN | last post by:
Hi I need to know how to get a form to auto populate, i.e. When I pick a city from Center Location, I would like the Operations Manger and SVP to populate once a selection is chosen. A related issue would be if I were to pick a selection from Root Cause I would want the Sub-root cause to filter out information that doesn't apply. And place a tag on the record which will show the last person to edit since there would be six individuals...
2
2285
by: buddyr | last post by:
Hello, I have a cmd button on form to search for serial number. I notice when I search for record-that if I don't start at the beginning of records I might not find the record. example: if I am searching for 20th record then I search for 10th record I will have to go to to beginning to search for 10th record. Any way to not have to go to the start each time? I have tried using code with find first in it- but it seems like find first is not...
1
2779
by: kickergirl | last post by:
I have a database developed in MS Access 2000 that allows people to enter training histories for staff. The staff information is stored in tblStaff, and the training histories are stored in tblTraining. The main form (frmDataEntry) contains the staff contact information and a continuous subform displaying the selected staff's training history. The desire was for the ability to allow the data entry person to search the database by staff's...
1
3976
by: ramel | last post by:
Hi all, I have a problem related to javascript , ajax and jsp. Please see this url http://xil.co.in/print_screen_2.JPG. I am working on this form. There are some buttons (like submit , add ,edit at bottom of this page , but not visible in printscreen). On click of a radio button on left side , form fields on right side and small table on right bottom is gettig populated. The table on right bottom , is actually the eligibility...
5
2719
by: andersond | last post by:
I probably didn't ask the question right; but, I have a webpage where agents are entering information about trucks they want insured. I want to break out of a function when a button push occurs. As agents are entering units, the first thing we ask for is the model year. This signals the beginning of a new entry. However, when they are finished with vehicle entry they can push a button called "Done with Units." When this occurs I want to...
5
3499
tsubasa
by: tsubasa | last post by:
I have a form in ASP.net that has a checkbox option to auto populate the form with the user infomation that is held in an table. When I select the checkbox the auto populate works well with texboxes in the form, but the auto populate does not work completely because a field in the form called shipcamp uses a dropdown list. How can I auto populate the camp field dropdown list as well using JavaScript? Thank you! -Tsu ...
0
10983
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10647
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10706
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10338
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7882
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7056
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5719
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.