Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically carrying one value from form to another form field

Status
Not open for further replies.

doommarine44

Technical User
Jan 22, 2005
11
US
I have a problem with my database.. Seems simple but its a true pain, driving me into many emotional states.

My main table is Inventory, then linked to customer info, then linked to payments..(this is a used car database)

My main problem is automation. The main field in concern is StockNumber, now that thats clear onward!!

Here is my scenario, I have my inventory form open, I enter all the data that is needed for that car, (lets say the car is Stocknumber 22 by Autonumber) then I click a command button that I have placed on the inventory form to open the customer info form, here is my REAL question,

1.) How would I make that command button carry the car I just entered's Stocknumber (and am currently viewing, which is Stocknumber 22) over to the customerinfo form's Stocknumber (which is stored in the customerinfo table), to tie them together??

I assumed that relationships would automatcially do this, if not, that truly isn't cool, and I guess code is the only way to go, and if it is code could you assit me with that code? I have coded with vb, but am VERY unfamilar with access VB (how to access all the forms etc)

Any help would be god like, as this is holding me back tremendously, and I have spent over 30 hours pondering the reason why it simply won't work easily. Attributing to much mental stress compounded by many other factors.

THANKS!

 
If the customerinfo form is always opened by the inventory form, the Stocknumber field (textbox) on the customerinfo form can reference the value directly like:
Code:
=Forms!frmInventory!Stocknumber

If not, you can check for the inventory form's state when the customerinfo form loads:
Code:
[green]'customerinfo form's load event[/green]
Private Sub Form_Load()
  If CurrentProject.AllForms("frmInventory").IsLoaded Then
    Me!Stocknumber = Forms!frmInventory!Stocknumber
  End If
End Sub

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top