473,509 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form that updates another form

19 New Member
Hi, I have been playing around with various forms and have asked some previous questions on this topic, but thought it best to start a new thread since my forms structes have changed if anyone can help I am almost there.

I have two forms
Form 1 =Detail
Form 2 =DetailUpdate (the fields in this form are bound to a table OrderDetailUpdate)

Detail displays information based on a combo box look up in a datasheet view from a table OrderDetail, the look up value is OrderNumber. I have a command button that opens the form in DetailUpdate , also a datasheet view and I want the data from Detail that is displayed to carry over to DetailUpdate. Form 1 has fields OrderNumber and PartNumber and I put code in the command button to put those fields into Form 2, this works but it only populates the first row and most times Form 1 has multiple lines on it. I was thinking if there was a way to instruct the code to append the data of all records from Form 1 to 2.


This is what I have right now:
////////////////////////////////////////////////////////////////////////////////////////
Expand|Select|Wrap|Line Numbers
  1. Private Sub OpenOrderUpdateForm_Click()
  2. On Error GoTo Err_OpenOrderUpdateForm_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "frmDetailUpdate"
  8.  
  9.        DoCmd.OpenForm stDocName
  10.     Forms!frmDetailUpdate!OrderNumber = Me.OrderNumber
  11.     Forms!frmDetailUpdate!PartNumber = Me.PartNumber
  12. Exit_OpenOrderUpdateForm_Click:
  13.     Exit Sub
  14.  
  15. Err_OpenOrderUpdateForm_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_OpenOrderUpdateForm_Click
  18.  
  19. End Sub
/////////////////////////////////////////////////////////////////////////////////////////////
This updates the first line, but that is all. Might be a simple answer, but I sure can't figure it out. Any help would be appreciated.

Thanks Mark.
Mar 13 '07 #1
7 1704
NeoPa
32,557 Recognized Expert Moderator MVP
Mark,
This is another example of where people will find it difficult to help. Your explanation makes it hard to understand what you're after. When you talk about sending something to another form, that's hard to understand as forms don't really store anything at all. They simply show data from a table or a query. Perhaps you could try to redo the question (in this thread) paying particular attention to making it clear what you're after.
Mar 17 '07 #2
mtrcct
19 New Member
Neo, I understand what you are saying and let me try to re-phrase.

I am building a purchasing database that the user enters requisition information in a table DetailHeader and Detail all from one form that I built and that works fine.

Now I am trying to build a form that takes the previously entered information from the Detail table and add the addtional purchase order information to each line so the user does not have to enter the information a second time.

I have a combo box that fills the form Detail when the user selects a requision number from table Detail and I want to take this information and move it to another form that is bound to the table DetailUpdate.

The code I posted above opens the form DetailUpdate via a command button and works for just one line, but does not increment the rows to match the results displayed that are currently displayed in the Detail form. Basically, I am trying to clone the form Detail but make it bound to another table.

I understand that a form displays data from a table, but was thinking if I could throw that result to another form it would make the data entry so much easier.

Thanks for the feedback and I hope this makes more sense.

Mark.
Mar 19 '07 #3
NeoPa
32,557 Recognized Expert Moderator MVP
I'm sorry Mark.
This makes little more sense to me. I can't give you an answer to this question.
I can't even tell you how you should write the question as I can't tell what you want. I don't mean to criticise so I'll just step back and leave you to decide how best to play it from here.
Mar 19 '07 #4
mtrcct
19 New Member
Neo, no offense taken.
I need to put this english so as not to waste any more of the experts time here. Thanks for your support, the forum is great. I am learning a lot just from reading responsed to questions that others have posted.
Mar 20 '07 #5
NeoPa
32,557 Recognized Expert Moderator MVP
I'm pleased you feel that way Mark.
I'll catch anything else you post here now so I'll see what I can do if you repost :)
Mar 20 '07 #6
Denburt
1,356 Recognized Expert Top Contributor
Hmmm let see if this will help you.


Expand|Select|Wrap|Line Numbers
  1. Private Sub OpenOrderUpdateForm_Click()
  2. On Error GoTo Err_OpenOrderUpdateForm_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6. Dim db as database
  7.     Dim rs as recordset
  8.     Dim rs1 as recordset
  9.  
  10.     stDocName = "frmDetailUpdate"
  11.  
  12.        DoCmd.OpenForm stDocName
  13. set db = currentdb
  14. set rs = me.recordsetclone
  15. set rs1 = db.openrecordset("OrderUpdate")
  16. If not rs.eof then 
  17. Do until rs.eof
  18. rs1.edit
  19. rs1.addnew
  20.  
  21.     rs1!OrderNumber = Me!OrderNumber
  22.     rs1!PartNumber = Me!PartNumber
  23.  
  24. rs1.update
  25. loop
  26. end if
  27. rs1.close
  28. rs.close
  29. set rs1 = nothing
  30. set rs = nothing
  31. set db = nothing
  32. Exit_OpenOrderUpdateForm_Click:
  33.     Exit Sub
  34.  
  35. Err_OpenOrderUpdateForm_Click:
  36.     MsgBox Err.Description
  37.     Resume Exit_OpenOrderUpdateForm_Click
  38.  
  39. End Sub
  40.  
Typing off the cuff here so I hope I didn't I miss anything.
Mar 20 '07 #7
mtrcct
19 New Member
Denburt, thanks for the info! I'll give it a try and let you know....

Mark.
Mar 23 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2218
by: Noozer | last post by:
We have a web based tool used to report issues in our office. Many times the users do not enter the required information to deal with the issue. Unfortunately we don't have control of this...
1
2185
by: Bill Strass | last post by:
Problem: Access main form/subform as front end to SQL Server backend. Add/edit via subforms work fine. Not so with main form. Set up a master-detail form-subform using two views linked from SQL...
13
7442
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
3
7371
by: Brian Keating EI9FXB | last post by:
Hello again, I've already placed a few posts on this topic. This time i've a simple application that exhibits my problem, I've placed sample solution 8k on my website should anyone be interested...
3
1340
by: Tim | last post by:
Hi, I have have a program containing two forms that are open at the same time. The main form updates the second when the user enters input by adding a control to it. My problem is that when the...
14
1910
by: bchi49 | last post by:
I'm having problem updating a form that queries from 3 tables. When I update the foreign key it tries to update the PK on the foreign key table which it shouldn't. I'm using MS Access 2003...
3
11069
by: Brian | last post by:
I have a form that has a textbox used to search records in a table. On the form I have a listbox which shows each record in the table. When you click on each row in the listbox the rest of the form...
6
2928
by: ortaias | last post by:
I have a listbox which can display all records or provide a limited list based on a filter derived from an optiongroup. The code works except in the one situation where the listbox filter is...
5
3574
by: wktarin | last post by:
Hi. I'm a relative newcomer to the world of php, and I keep bumping into a problem with a mail () form. I need to send an automatic email to two addresses, but I can't seem to get it to work. One...
0
7233
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
7410
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
7505
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...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
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...
0
4729
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...
0
3215
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...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.