Macro SetValue

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I learned how to setvalues from Unbound to bound text fields on a form. But I cannot find information on setting a value from one forms unbound Text box to another forms Bound Text box (or from one bound test on a form to another bound text on another form).

It would be creating a new record in the table the second form is bound to.

Any guidance or help is appreciated.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
unbound or bound, all you do is set it:
txtbox = 4

or across forms
forms!myForm1!txtBox1 = forms!myForm2!txtBox2
 
Upvote 0
can you do it to a table? Tables!RFPManager!PID_Number
 
Upvote 0
can you do it to a table? Tables!RFPManager!PID_Number

You would populate the bound control with a value

To update a table you would use a query or a recordset.

I'd say it really depends on your process.
 
Upvote 0
I create a "new Proposal number" with a form (frmPIDGenerator). I wanted to take that number (aka field) and add it as a new record in a table (which is not bound to the first form). The user uses a different form (frmRFPManager) to enter data. They have a Listbox to select the Proposal number from before they enter data against that proposal. This list is a Listbox from the tblRFPManager. Which is why I want to SetValue the field value from the frmPIDGenerator, or its bound table tblPidGenerator, to the tblRFPManager. Hope that makes sense.
 
Upvote 0
Somewhat :)
I *think* you need to append the ID to the table, then use your other form to populate the rest of the record.?
So use a query statement in VBA (it will be quite simple) to append a new record, open your new form and pass the ID (openargs?) and close the first form.
One form would probably be a lot easier?
I must admit I tend to use bound forms for the most part and the built in Access functions like * in the form navigation area to create a new record.

You could have one form with the button to create the record on your second form, once clicked, perhaps disable it until the record has been populated to your satisfaction. Again a lot would depend on the structure of the DB.

I do tend to go for an easy route due to my inexperience with Access. :)
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top