473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Populate text box on new form based on another open form

43
On my form I have a text box (in the detail section) that populates based on the selection made from a combo box in the header section of my form. Now I need for the information that populates the text box to transfer to another form that opens when the okay in the msgbox is click. I hope this makes since.
Here is the code I've come up with so far:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. DoCmd.GoToRecord , , acNewRec
  3. Me.CreationDate = Now()
  4. Me.LotNumber.Value = Forms!GeneralTabWeld.LotNumber.Value
  5. End Sub
  6.  
I have read multiple post and tried to get this to work before posting this question. Help would be greatly appreciated.

Thanks
Mar 21 '13 #1

✓ answered by Seth Schrock

I'm not finding where I mentioned the Where Condition, but in this context I'm guessing it refers to the Where Condition that is part of the DoCmd.OpenForm syntax (one of the optional arguments). And no, there is nothing after Me.OpenArgs.

Try this
Expand|Select|Wrap|Line Numbers
  1. Private Sub GOOD_Click()
  2. If Not IsNull(Me.SN.Value) Then
  3.     LastPosSN = Me.SN.Value
  4. End If
  5. If PosPullTestCount = Me.PullTestNum.Value Then
  6.     MsgBox "Time to perform a pull-test on a scrap cell!"
  7.     PosPullTestCount = 1
  8.     Me.Text30.Value = Me.PullTestNum.Value
  9.     DoCmd.OpenForm "GeneralTabPullTest"
  10.  
  11. Else
  12.     PosPullTestCount = PosPullTestCount + 1
  13.     Me.Text30.Value = Me.PullTestNum.Value
  14. End If
  15. DoCmd.GoToRecord , , acNewRec
  16. Me.CreationDate = Now()
  17. Forms!GeneralTabPullTest!LotNumber = Me.LotNumber
  18. End Sub
  19.  

7 5272
Seth Schrock
2,965 Expert 2GB
Do you get an error message with this? Try replacing line 4 with
Expand|Select|Wrap|Line Numbers
  1. Me.LotNumber = Forms!GeneralTablWeld!LotNumber
The other option would be to use the form's OpenArgs. In the code that opens the form (not sure how to do this in a macro), the last argument is the OpenArgs. You can make that be Me.LotNumber. Your line 4 would then become
Expand|Select|Wrap|Line Numbers
  1. Me.LotNumber = Me.OpenArgs
Mar 21 '13 #2
tmdrake
43
Hi Seth, I not getting any error messages. But I did notice something else. If I open the "GeneralTabWeld" form (this is the form where the use makes a selection) first, then wihout using any of the buttons, I open the "GeneralTabPullTest" form, the information transfers. But if the "GeneralTabPullTest" form is called by using a button on the "GeneralTabWeld" form the information does not transfer.

Here is the code calling the "GeneralTabPullTest" form using a button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub GOOD_Click()
  2. If Not IsNull(Me.SN.Value) Then
  3.     LastPosSN = Me.SN.Value
  4. End If
  5. If PosPullTestCount = Me.PullTestNum.Value Then
  6.     MsgBox "Time to perform a pull-test on a scrap cell!"
  7.     PosPullTestCount = 1
  8.     Me.Text30.Value = Me.PullTestNum.Value
  9.     DoCmd.OpenForm "GeneralTabPullTest"
  10.  
  11. Else
  12.     PosPullTestCount = PosPullTestCount + 1
  13.     Me.Text30.Value = Me.PullTestNum.Value
  14. End If
  15. DoCmd.GoToRecord , , acNewRec
  16. Me.CreationDate = Now()
  17. End Sub
  18.  
Should the code to transer from the "GeneralTabWeld" form to the "GeneralTabPullTest" form go somewhere in here.

As Always
Thanks
Mar 21 '13 #3
Seth Schrock
2,965 Expert 2GB
I think what is happening is that order of what is happening is that
1. Line 9 from above opens the form
2. The form's OnLoad event triggers and sets the control to the value you are wanting
3. Line 15 runs moving the form to the new record.

Just to be sure, which form is getting moved to a new record? You can also watch to see if this is in fact what is happening by putting a stop between lines 1 & 2 in your above code and then using F8 to step through the code and watch when values are getting changed.

You can put the code to transfer the value in you above code, but you would have to switch which control is getting the full reference. Like this:
Expand|Select|Wrap|Line Numbers
  1. Forms!GeneralTabPullTest!LotNumber = Me.LotNumber
Mar 21 '13 #4
tmdrake
43
Hi Seth,

I have tried it both ways, but neither is working. With the OpenArgs code, isn't there something that should follow the
Me.OpenArgs?
I've been trying to figure out what the "Where Condition" means.

Any help is appreciates.
Mar 25 '13 #5
Seth Schrock
2,965 Expert 2GB
I'm not finding where I mentioned the Where Condition, but in this context I'm guessing it refers to the Where Condition that is part of the DoCmd.OpenForm syntax (one of the optional arguments). And no, there is nothing after Me.OpenArgs.

Try this
Expand|Select|Wrap|Line Numbers
  1. Private Sub GOOD_Click()
  2. If Not IsNull(Me.SN.Value) Then
  3.     LastPosSN = Me.SN.Value
  4. End If
  5. If PosPullTestCount = Me.PullTestNum.Value Then
  6.     MsgBox "Time to perform a pull-test on a scrap cell!"
  7.     PosPullTestCount = 1
  8.     Me.Text30.Value = Me.PullTestNum.Value
  9.     DoCmd.OpenForm "GeneralTabPullTest"
  10.  
  11. Else
  12.     PosPullTestCount = PosPullTestCount + 1
  13.     Me.Text30.Value = Me.PullTestNum.Value
  14. End If
  15. DoCmd.GoToRecord , , acNewRec
  16. Me.CreationDate = Now()
  17. Forms!GeneralTabPullTest!LotNumber = Me.LotNumber
  18. End Sub
  19.  
Mar 25 '13 #6
tmdrake
43
Seth, you Rock, it worked.

Thank you so much, now I can move on to the next problem.

Toni
Mar 25 '13 #7
Seth Schrock
2,965 Expert 2GB
Glad it worked. If you would, please select the post that helped you as best answer. This will make it easier for others viewing the thread to know which one helped solve the problem the most.
Mar 25 '13 #8

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

Similar topics

1
by: Steven C | last post by:
Hello: I am a Forxpro developer trying to come up to speed in C#. I'm trying to do in C# what I do effortlessly in Foxpro, and that is to call a grid refresh method in the parent form from the...
3
by: VMI | last post by:
In my MDI Widows app, how can I open a child Form X from within another child Form Y so that X is still inside the parent MDI Form? I'm using this code to open the Form from X (a child Form) but it...
3
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The...
5
by: bbawa1 | last post by:
I have a web form welcome.asp and it has three textboxes and two dropdown list. It has one button called Submit. when I click that button it should pass all the data from text boxes and...
2
by: MickT | last post by:
On an MDI application in VB.NET, I have one child form with a multiline text box. I am opening another child form, from the first form, as a "help" to create a SQL statement on the first form, by...
1
vikas251074
by: vikas251074 | last post by:
have a user-password screen in one form. And every module has separate form. I need to pass user-name and user-level to all the form. I am using Form 6i and Oracle 8. Thanx in advance Vikas
8
sickenhoofer
by: sickenhoofer | last post by:
I have a form, 'frmProviderMain' with a macro which opens another form, frmEnrollmentProcessing.The macro is located on a tab on 'frmProviderMain.' I would like one of the controls/fields on the...
4
by: KMSDXB | last post by:
Hi, I have three forms. "Main form" is a container and "Logon Form" is the child of this. I want to invoke another "AppLogin Form" from "Logon Form" as a child form to get the login details to a...
0
by: sudhirb | last post by:
Hello I am using MS Access 2003. I have a parent form based on parent table which contains unique ID field( primary key) which i enter first on the parent form. Parent table also contains fields...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.