Access: Load data from one form to another

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,332
Office Version
  1. 365
Platform
  1. Windows
I have code that loads data that is selected on one form to another form (Someone here helped me with - thanks!!!!!)

The code runs great except for the last line that I tried to add. I want filed "_Upload" to equal "Y". Its a Combo box Formatted True/False

Code:
Private Sub LoadItemId_Click()
[Forms]![frm_VendorQuoteData].[ITEM_ID].Value = Me.ItemID.Value
[Forms]![frm_VendorQuoteData].[_ITEM_ID_DESC].Value = Me.Description.Value
[Forms]![frm_VendorQuoteData].[ITEM_RVSN_ID].Value = Me.Rev.Value
[Forms]![frm_VendorQuoteData].[_COMMD_CODE].Value = Me.Commodity.Value
[Forms]![frm_VendorQuoteData].[QT_UM_CD].Value = Me.UM.Value
[Forms]![frm_VendorQuoteData].[_Upload] = "Y"
End Sub

Also how do I ensure that form "frm_VendorQuoteData" is open when code is run?. I don't want to open the form, I want to make sure it was already open.

Thanks
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
If it is a True/False field, it stored values are typically True/False, or numerically -1, 0 (and not the string value "Y").

So try:
Code:
[Forms]![frm_VendorQuoteData].[_Upload] = True
or
Code:
[Forms]![frm_VendorQuoteData].[_Upload] = -1
 
Last edited:
Upvote 0
Thanks Joe. Is there a way to make sure the form "frm_VendorQuoteData" is open before the code is run?
 
Upvote 0
How is this code being called? Is it being called from an event on that Form (if so, the Form would have to be open already)?
If not, you will need to add a "DoCmd.OpenForm" command at the beginning of your code.

Note, I see that you have a few question recently that involve using the various "DoCmd" commands.
Most of these are available under the "Macros" sections. A good way to get the exact code that you need with all the right arguments/values is to create a simple Macro to perform that action (i.e. Open a specific form). Then, convert that Macro to VBA code using the "Convert Macros to Visual Basic" action (found on Macro toolbar). Then, you can just copy/paste the needed lines of code that you need from the converted function to your VBA code.
 
Upvote 0
https://social.msdn.microsoft.com/F...test-to-see-if-a-form-is-open?forum=accessdev

Found using https://www.google.com/search?ei=K5.....0.0..0.0.0.......0......gws-wiz.L9NbBf0X6h0

I have code that loads data that is selected on one form to another form (Someone here helped me with - thanks!!!!!)

The code runs great except for the last line that I tried to add. I want filed "_Upload" to equal "Y". Its a Combo box Formatted True/False

Code:
Private Sub LoadItemId_Click()
[Forms]![frm_VendorQuoteData].[ITEM_ID].Value = Me.ItemID.Value
[Forms]![frm_VendorQuoteData].[_ITEM_ID_DESC].Value = Me.Description.Value
[Forms]![frm_VendorQuoteData].[ITEM_RVSN_ID].Value = Me.Rev.Value
[Forms]![frm_VendorQuoteData].[_COMMD_CODE].Value = Me.Commodity.Value
[Forms]![frm_VendorQuoteData].[QT_UM_CD].Value = Me.UM.Value
[Forms]![frm_VendorQuoteData].[_Upload] = "Y"
End Sub

Also how do I ensure that form "frm_VendorQuoteData" is open when code is run?. I don't want to open the form, I want to make sure it was already open.

Thanks
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,185
Members
448,554
Latest member
Gleisner2

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