Happy New Year Everyone - one last glitch to fix

RexesOperator

Registered User.
Local time
, 22:30
Joined
Jul 15, 2006
Messages
604
I have a main form frmAddNewTransactions and a separate POPUP form frmCompanyList. I am trying to set up a routine such that clicking once on a field in the popup form will load the appropriate fields in the main form.

So far I have:

Private Sub txtContactID_Click()

Form!frmAddNewTransactions!txtContactID = Form!frmCompanyList!txtContactIDPOPUP

End Sub

I also tried

Forms!frmAddNewTransactions!txtContactID = Forms!frmCompanyList!txtContactIDPOPUP

This doesn't work. I am sure I am missing something simple here (as usual). I am using Access 2003.
 
Is there a reason why you're using a popup form instead of simply having a combobox to select and load the company data?
 
Other than it's what my manager asked for - no. He comes from an Excel background so maybe combo boxes aren't his thing? But since he's the one who's going to maintain this beast as of April 1 (when I retire - yippee!), I am trying to give him what he wants.
 
Hello,

I would do this:

Set a variable to the Forms!frmCompanyList!txtContactIDPOPUP
Close the Forms!frmCompanyList
GotoControl txtContactID
And then use the FindRecord command to goto the record of choice.

Hope this helps.

Art
 
It should work.

I rarely use PopUp forms but I just made one and tried this

Forms!masterform!CLSurname = Forms!formpopup!Text0

and it worked. I also made the Modal and it still worked OK.

I think I must need new glasses because the two ypu posted look the same to me.

When you say it does not work, what happens...nothing, error.....
 
missinglinq

A few hours ago I was searching on the internet because I had error 6 and overflow in a Select Case module. It was for dollar groups going up by $5000 and when I hit 35000 the query brought up the error.

In my seacrh I ran across a post you had made some time ago on some other forum. As a result I changed Integer to Double in the module, problem solved:D The bit about the 32276 limit on integer.

Many thanks

Edit. Here was the post, you are dwn at the bottom of the thread

http://www.tek-tips.com/viewthread.cfm?qid=1504372&page=10
 
The difference between them is FORM! and FORMS! The error is that Access can't find the frmAddNewTransactions.
 
I can get the main form to grab the data from the POPUP. So it is not because of a spelling error. And since both forms are opened with a macro at the same time, I know the main form is open. Could it be because the POPUP has the focus? Although I have tried this with the second form POPUP set to no. Can the focus be changed to the main form with a macro, or will it have to be opened by code with the focus set?
 
I can get the main form to grab the data from the POPUP.

Is it working.

I just made a macro to open the popup first and then the main form.

The popup has an unbound textbox with =Date().

I put this for OnClock on the textbox

Forms!masterform!CLSurname = Forms!formpopup!Text0

and also for OnClick on a standalone label. Either works.

Which for has focus should make no difference. I am using Access 2003

If you can't get it to work then try using SetValue action in a macro

Item [Forms]![frmAddNewTransactions]![txtContactID]
Expression [Forms]![frmCompanyList]![txtContactIDPOPUP]
 
If you are clicking on the popup, all you need is

Forms!frmAddNewTransactions.txtContactID = Me.txtContactID

If the text box on the popup is named txtContact. If it is named txtContactIDPOPUP then you can use

Forms!frmAddNewTransactions.txtContactID = Me.txtContactIDPOPUP

provided that the names are correct (note the use of the dot over the bang).
 
Maybe this is a control reference issue. The txtControlID is on the first page of a tab control so I have also tried Forms!frmAddNewTransactions.tabMAIN.txtContactID = Me.txtContactIDPOPUP but I get an error saying the property or method isn't supported. This first page on the tab is NOT a subform.

However I am half way to what I want - I will put a command button on the main form that will fill in the information from the popup rather than the other way around. It still saves typing and reduces errors (the object of the exercise) so I will go on to other things.
 
Maybe this is a control reference issue. The txtControlID is on the first page of a tab control so I have also tried Forms!frmAddNewTransactions.tabMAIN.txtContactID = Me.txtContactIDPOPUP but I get an error saying the property or method isn't supported. This first page on the tab is NOT a subform.

However I am half way to what I want - I will put a command button on the main form that will fill in the information from the popup rather than the other way around. It still saves typing and reduces errors (the object of the exercise) so I will go on to other things.

Just an FYI - when on a tab you don't reference it at all in code as it is just as if the tab control doesn't exist.

I just think that you are having issues because of some naming issue. You aren't referring to the right name of something. Perhaps if you posted your db we could get to the bottom of this within seconds instead of doing all of the guessing.
 
Nothing comes easy on this one does it?

You will get an On-load error when you open the main form frmAddNewTransactions - I didn't delete the calendar routines.
 

Attachments

Looking at the initial stuff I don't understand a couple of things.

1. Your double-click of the companyID on the frmAddNewTransactions refers to a macro that doesn't exist.

2. when changed to macAddNewTransactions it opens the popup but it has the current values but there is no way to add a new company.
 
I didn't include all the macros and functionality. The double click opens a report that is a help file for that control. The macAddNewTransactions should open the form in add mode. It does work properly in the database. It also opens the frmCompanyList that is the popup.
 
Looking at the initial stuff I don't understand a couple of things.

1. Your double-click of the companyID on the frmAddNewTransactions refers to a macro that doesn't exist.

2. when changed to macAddNewTransactions it opens the popup but it has the current values but there is no way to add a new company.

Ditto.

I thought the subject of the thread was to do with code attached to the text box on the popup form but I could not see anything there, code or macro for setvalue to the main form.
 
Sorry - I got distracted. I guess I didn't finish cleaning the stripped down version.

Now there are no extraneous macro calls etc. If you click on the macAddNewTransactions it should open the form frmAddNewTransactions and the pop-up form frmCompanyList. I also added the code in question to the pop-up form frmCompanyList. frmCompanyList is based on the query qryAllCompanies and the form frmAddNewTransactions is based on the query qryAddNewTransactions.
 

Attachments

Change the code on your popup to

Forms!frmAddNewTransactions!ContactID = Me.txtContactIDPOPUP

and it will work
 
Now my eyes must be getting to me - what was different from what I had? BTW Thank you - again.
 

Users who are viewing this thread

Back
Top Bottom