By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

Form that updates another form

P: 19
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
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  7.     stDocName = "frmDetailUpdate"
  9.        DoCmd.OpenForm stDocName
  10.     Forms!frmDetailUpdate!OrderNumber = Me.OrderNumber
  11.     Forms!frmDetailUpdate!PartNumber = Me.PartNumber
  12. Exit_OpenOrderUpdateForm_Click:
  13.     Exit Sub
  15. Err_OpenOrderUpdateForm_Click:
  16.     MsgBox Err.Description
  17.     Resume Exit_OpenOrderUpdateForm_Click
  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
Share this Question
Share on Google+
7 Replies

Expert Mod 15k+
P: 31,475
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

P: 19
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.

Mar 19 '07 #3

Expert Mod 15k+
P: 31,475
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

P: 19
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

Expert Mod 15k+
P: 31,475
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

Expert 100+
P: 1,356
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
  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
  10.     stDocName = "frmDetailUpdate"
  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
  21.     rs1!OrderNumber = Me!OrderNumber
  22.     rs1!PartNumber = Me!PartNumber
  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
  35. Err_OpenOrderUpdateForm_Click:
  36.     MsgBox Err.Description
  37.     Resume Exit_OpenOrderUpdateForm_Click
  39. End Sub
Typing off the cuff here so I hope I didn't I miss anything.
Mar 20 '07 #7

P: 19
Denburt, thanks for the info! I'll give it a try and let you know....

Mar 23 '07 #8

Post your reply

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