473,320 Members | 1,939 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.

Returing item form one form to another.

106 100+
Hi

I have form for data entry, and I have a dropdown list and a button called look up next to which opens a new form with information it for a particular item in the drop down list.
in a new form I want to add another button so when the user press it it return some of the information to the original forms so the user doesn't have to type information in.

Can any one let me know how can I do this

Thanks
Nov 8 '06 #1
6 1305
MMcCarthy
14,534 Expert Mod 8TB
Hi

I have form for data entry, and I have a dropdown list and a button called look up next to which opens a new form with information it for a particular item in the drop down list.
in a new form I want to add another button so when the user press it it return some of the information to the original forms so the user doesn't have to type information in.

Can any one let me know how can I do this

Thanks
You'll need something like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub commandBtnName_OnClick()
  3.  
  4.   Forms![FirstFormName]![textboxname1] = Me.TextboxName1
  5.   Forms![FirstFormName]![textboxname2] = Me.TextboxName2
  6.   'etc...
  7.  
  8. End Sub
  9.  
  10.  
Nov 8 '06 #2
tara99
106 100+
You'll need something like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub commandBtnName_OnClick()
  3.  
  4.   Forms![FirstFormName]![textboxname1] = Me.TextboxName1
  5.   Forms![FirstFormName]![textboxname2] = Me.TextboxName2
  6.   'etc...
  7.  
  8. End Sub
  9.  
  10.  
How can i do this if I want it to return in subform of a form?
and don't want it to overwrite the existing data, It should be return in the black field?
Nov 8 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub commandBtnName_OnClick()
  3.  
  4. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname1]) Then
  5. Forms![FirstFormName]![SubformName].Form![textboxname1] = Me.TextboxName1
  6. End If
  7.  
  8. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname2]) Then
  9. Forms![FirstFormName]![SubformName].Form![textboxname2] = Me.TextboxName2
  10. End If
  11.  
  12. 'etc...
  13.  
  14. End Sub
  15.  
  16.  
Nov 8 '06 #4
tara99
106 100+
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub commandBtnName_OnClick()
  3.  
  4. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname1]) Then
  5. Forms![FirstFormName]![SubformName].Form![textboxname1] = Me.TextboxName1
  6. End If
  7.  
  8. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname2]) Then
  9. Forms![FirstFormName]![SubformName].Form![textboxname2] = Me.TextboxName2
  10. End If
  11.  
  12. 'etc...
  13.  
  14. End Sub
  15.  
  16.  
Thanks
It worked
Nov 8 '06 #5
tara99
106 100+
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub commandBtnName_OnClick()
  3.  
  4. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname1]) Then
  5. Forms![FirstFormName]![SubformName].Form![textboxname1] = Me.TextboxName1
  6. End If
  7.  
  8. If IsNull(Forms![FirstFormName]![SubformName].Form![textboxname2]) Then
  9. Forms![FirstFormName]![SubformName].Form![textboxname2] = Me.TextboxName2
  10. End If
  11.  
  12. 'etc...
  13.  
  14. End Sub
  15.  
  16.  
Thanks it worked
now I want it to be handle few other things one is that if the data is already there it shouldn't added it again.

my subform is the the form of datasheet, and the code above works when I select (put the cursor) in the empty field.

Is it possible to for it to move to the next field (in this case next row) when the field is full, and finds the empty field and insert information there, and also if the infomation is there It shouldn't add it.

Thanks
Nov 8 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
Thanks it worked
now I want it to be handle few other things one is that if the data is already there it shouldn't added it again.
This should be handled by the 'If IsNull statement'. Let me know if its not working.

my subform is the the form of datasheet, and the code above works when I select (put the cursor) in the empty field.

Is it possible to for it to move to the next field (in this case next row) when the field is full, and finds the empty field and insert information there, and also if the infomation is there It shouldn't add it.
This is a much more complicated code requireing the use of recordsets. Instead of refering to the subform controls you would refer to a recordset based on its Record Source. Run through the recordset and update each record individually. Then requery the subform.

Try setting it up yourself and post any problems you run into.

Mary
Nov 8 '06 #7

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

Similar topics

0
by: Sandra | last post by:
I have a form with a list view control that has the checkboxes property set to true. This provides checkboxes as the first column in the listview. When a listviewitem is checked another form is...
11
by: Craig Francis | last post by:
Ok I'm making a fairly simple application. It contains 2 web browsers, the top one is used so that you can view a website (i.e. one you have created). Every time you load a page, the HTML which...
6
by: Agnes | last post by:
In my menu, there is invoice,customer .... etc As the user click 'Invoice' , the invoice form is load, then I want to disable the "Invoice" menu in the Menuitem, ,so the user can only new one...
2
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
10
by: WhiskyRomeo | last post by:
I have webservices functions that return datasets. If a database errors happens, try catch statements can be used in the webservice to detect and handle them. However, how do I return that...
1
by: Atreju | last post by:
Ok I got form within a c sharp page. Situation: On the form I have a drop downliwst and a textbox, the dropdownlist is populated with products and the textbox has a default vale of the product...
6
by: btknorr | last post by:
The following html and javascript combination fails to execute in Internet Explorer...does anyone know why? If you change the input's attribute "name" to anything other than "item" it works just...
4
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at...
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.