Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-14-2019, 02:34 PM   #16
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

Quote:
Originally Posted by jdraw View Post
Can you show us a graphic of your tables and relationships (relationships window)?
Any suggestion regarding the relationships?

Fira_g is offline   Reply With Quote
Old 11-14-2019, 02:39 PM   #17
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

And the subject of this thread should read:
"Inserting currentRecord from open form to another form.
Fira_g is offline   Reply With Quote
Old 11-14-2019, 02:44 PM   #18
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Quote:
Originally Posted by Fira_g View Post
Any suggestion regarding the relationships?
Hi. If you don't mind, I do have a couple of questions about it.
  1. What is the difference between Pick and Drop locations?
  2. In tblOrders, does EmployeeID refers to the person who took the order?
  3. Are drivers not considered as "employees?" If they are, how come they're not in the Employees table?
That's it for now...

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-14-2019, 02:50 PM   #19
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Quote:
Originally Posted by Fira_g View Post
And the subject of this thread should read:
"Inserting currentRecord from open form to another form.
Hi. That's not really the same as what I thought you were asking. I thought you were wanting to know how to transfer/copy the CustomerID value from one form to another. A CustomerID value is just one value, it is not really a "record."


In any case, if you are looking for a way to copy the current CustomerID on your form to another, you could try the following syntax:


Forms!NameOfOtherForm.NameOfControlOnThatForm = Me.CustomerID


However, for the above syntax to work, the other form must also be open to accept the value you are transferring.


If you are truly asking how to copy an entire record from one form into another, that would involve a different approach/syntax.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-15-2019, 05:06 AM   #20
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

Quote:
Originally Posted by theDBguy View Post
Hi. That's not really the same as what I thought you were asking. I thought you were wanting to know how to transfer/copy the CustomerID value from one form to another. A CustomerID value is just one value, it is not really a "record."
That is exactly what I want, value of one field to transfer to another, I need to get the terms right. )
Fira_g is offline   Reply With Quote
Old 11-15-2019, 05:20 AM   #21
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

Quote:
Originally Posted by theDBguy View Post
Hi. If you don't mind, I do have a couple of questions about it.
  1. What is the difference between Pick and Drop locations?
  2. In tblOrders, does EmployeeID refers to the person who took the order?
  3. Are drivers not considered as "employees?" If they are, how come they're not in the Employees table?
That's it for now...
Pickup and Drop locations are 2 different geographical locations. Driver goes to the Pick location takes the load delivers to the Drop location.

Yes, EmployeeID is the person that who took the order.
Drivers are mainly contractors, but I was thinking of merging this 2 tables.
Fira_g is offline   Reply With Quote
Old 11-15-2019, 05:34 AM   #22
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

Quote:
Originally Posted by theDBguy View Post

In any case, if you are looking for a way to copy the current CustomerID on your form to another, you could try the following syntax:


Forms!NameOfOtherForm.NameOfControlOnThatForm = Me.CustomerID


However, for the above syntax to work, the other form must also be open to accept the value you are transferring.
Any ideas why my the current code doesn't work?:

Code:
Private Sub InserttoMainOrder_Click()
DoCmd.OpenForm "frmMainOrders", , , "CustomerID = " & Me.CustomerID
End Sub

Fira_g is offline   Reply With Quote
Old 11-15-2019, 05:39 AM   #23
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Quote:
Originally Posted by Fira_g View Post
Any ideas why my the current code doesn't work?:

Code:
Private Sub InserttoMainOrder_Click()
DoCmd.OpenForm "frmMainOrders", , , "CustomerID = " & Me.CustomerID
End Sub
Hi. What does "doesn't work" mean? The form is not opening? It's not filtering to the correct customer? Are you getting any errors?
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-15-2019, 05:41 AM   #24
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

The frmMainOrders opens but nothing the value won't transfer, just a blank form.
Fira_g is offline   Reply With Quote
Old 11-15-2019, 05:44 AM   #25
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Quote:
Originally Posted by Fira_g View Post
The frmMainOrders opens but nothing the value won't transfer, just a blank form.
Hi. Did you try the syntax I gave you earlier? And how come you don't want to switch to a subform? Just curious...
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-15-2019, 06:25 AM   #26
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

The syntax you provided works exactly as you advised: other form needs to be opened and the focus remains on the Customer form.

The Order form(frmMainOrders) works with no problem. I type the customer name in Customer field and it filters it as I type, thanks to help from members of this website.
Now when I want to add new customer that is not in the list, I click the + button and it takes me to the Customer form, so I add new customer.
Now as I am on the Customer form rn, I want a button on that form to populate the newly added CustomerID from the Customer form back to the MainOrders form.
That is why )
Fira_g is offline   Reply With Quote
Old 11-15-2019, 07:57 AM   #27
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Quote:
Originally Posted by Fira_g View Post
The syntax you provided works exactly as you advised: other form needs to be opened and the focus remains on the Customer form.

The Order form(frmMainOrders) works with no problem. I type the customer name in Customer field and it filters it as I type, thanks to help from members of this website.
Now when I want to add new customer that is not in the list, I click the + button and it takes me to the Customer form, so I add new customer.
Now as I am on the Customer form rn, I want a button on that form to populate the newly added CustomerID from the Customer form back to the MainOrders form.
That is why )
So, the syntax should still work the same even if you're on the new customer form. Perhaps, if you could post a sample copy of your db, we could see where the disconnect is. But again, if it was me, I think a form/subform would be a simpler solution for this. Just my 2 cents...
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 11-16-2019, 12:00 PM   #28
Fira_g
Newly Registered User
 
Join Date: Oct 2019
Posts: 60
Thanks: 5
Thanked 1 Time in 1 Post
Fira_g is on a distinguished road
Re: Inserting current from open form to another form.

I need to keep the form as it is rn as that is how it was requested, because it should be about the order/load not about customer. I will have a query/Form that will show orders by customer that will be Customer form with orders subform in datasheetview.

I am using code below now to open the main form, transfer the value and and close the customer form

Code:
If IsNull(Me.CustomerID) Then
    MsgBox "Please Select or Add a Company First", vbOKOnly
    Me.CustomerID.SetFocus
    Exit Sub
End If

DoCmd.OpenForm "frmMainOrders"
Forms!frmMainOrders.CustomerID = Me.CustomerID
DoCmd.Close acForm, "frmCustomers"
It seems to work, but I am pretty sure it needs some improvements.
Fira_g is offline   Reply With Quote
Old 11-16-2019, 12:20 PM   #29
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 6,653
Thanks: 58
Thanked 1,459 Times in 1,440 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Inserting current from open form to another form.

Hi. Glad to hear you got it sorted out. Good luck with your project. We'll be here if you need us again.

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open form to record with button on current form Paul Clark Modules & VBA 4 01-23-2018 03:14 AM
Using current form's record, open another form on click karmacable Forms 4 09-22-2011 12:48 PM
open a form based on the record that is selected in current form s_samira_21 Forms 23 06-12-2011 01:52 AM
Button to save current form and open another from with some data from firt form Nicolette Forms 0 08-03-2010 03:02 PM
Close form, open new form on current record humphreya Visual Basic 0 12-02-2005 11:00 AM




All times are GMT -8. The time now is 12:45 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World