473,659 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy data from one form to another and create a new record to add data

Ok, here's the outline:

I have a form called frmOrders, which has a subform (frmOrderDetail s)
and another form called frmProducts.

In frmOrderDetails , when I double-click on a field called ProdDescrip
it opens frmProducts, which gives me a product list and it's prices.
When I double-click a product, automatically add the products to the
frmOrderDetails fields ProdDescrip and UnitPrice. But I can't save the
record in frmOrderDetails and move to a new one so I can add more
products.

This is the code on frmProducts

Private Sub ProductName_Dbl Click(Cancel As Integer)

Forms![frmOrders]![frmOrderDetails]![ProdDescrip] = [ProductName]
Forms![frmOrders]![frmOrderDetails]![UnitPrice] = [ProductPrice]

I've already tried with SaveRecord, GetFocus, and nothing seems to
work.

Any suggestions?

Nov 13 '05 #1
4 2560
Do you get an error message when you try to save your order details
record? If so, what is it?

Bruce

Nov 13 '05 #2
There's no error... it only stays in the same record on the subform.

I've tried with this:

Private Sub ProductName_Dbl Click(Cancel As Integer)

Forms![frmOrders]![frmOrderDetails]![ProdDescrip] = [ProductName]
Forms![frmOrders]![frmOrderDetails]![UnitPrice] = [ProductPrice]
DoCmd.RunComman d acSaveRecord
DoCmd.RunComman d acRecordGoToNew

But it saved the record and create a new one on the frmProducts, not
the frmOrderDetails subform.

Nov 13 '05 #3
Try replacing your DoCmd...SaveRec ord with either

Forms!frmOrders !frmOrderDetail s.Form.Dirty = False

or

Forms!frmOrders !frmOrderDetail s.Form.Refresh

provided that the Order Details subform object on frmOrders has the
same name as its source form (frmOrderDetail s).

Bruce

Nov 13 '05 #4
I got to save the record. But how do I get to create automatically a
new record on the subform (frmOrderDetail s)? 'Cause the goal is to add
automatically products to the subform by double-clicking on the
ProductName field of frmProducts.

Richie

Nov 13 '05 #5

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

Similar topics

2
4135
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5 Groups - call them A to E. I'd like to generate a further automatic reference number based on something like Group/Unique ID so when I create a new record Access creates the Unique ID & I then enter in the group and then Access combines the two...
3
8356
by: Tlm | last post by:
Hello All, I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also has a subform embedded in it (SubFrmC) The form's recordsource is based on a table (TblA). SubFrmB's recordsource is also based on a table (TblB). SubFrmC's recordsource is also based on a table (TblC). There is a one-to-many relationship between TblA (one) and TblB (many).
5
2678
by: Daniel Tan | last post by:
Are there anyway to copy rows of records from one query to another query and then hide the records in source query ? Pls advise. Thanks. Regards, Daniel
1
2558
by: Sean Howard | last post by:
Dear All, As is my want I need to do something in Access that seems simple but cannot fathom out. I have main form with two subforms, both datasheets with an almost identical table structure. I want to add the functionality to copy records from subformA to subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
1
2788
by: SuffrinMick | last post by:
Hi All I have two tables: tblRecords and tblOptions. tblRecords consists of RecordID (autonumber), Record (text) and Option (text record of options chosen) fields tbloptions consists of OptionID (autonumber) and Option (text) fields. I want to use a form to add/update the records table.
3
3210
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data. The PK (ProductID) for each record on the form is an AUTONUMBER. This form also has a sub-form, linked via ProductID. The subform also
19
3463
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
2
3461
by: Swinky | last post by:
I hope someone can help...I feel like I'm walking in the dark without a flashlight (I'm NOT a programmer but have been called to task to do some work in Access that is above my head). I have code that will successfully copy a record and append the information to a new record in the same table (parent table) within a form. However, there are related child tables with primary keys (set to Autonumber) stored in sub-forms. That information...
3
9235
by: Richnep | last post by:
Hi all, I have tabbed subforms where I need to copy one field value from one subform over to another subform. Although I can run an update query to accomplish this I would like to do it through VBA. sub tables relationships are 1:N with the main table. So the recods display like this in the subform:
1
1742
by: chrisdavis | last post by:
I have a submission form with data in it that is submitted into "tblSubmitter" with basic information. I need to take every third record and mark a "status" to it. For Example: (these are unique ID's in the table, SUBMITERID) 1 2 3 4
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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
8746
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
8525
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,...
1
6179
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
5649
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
4175
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.