Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-12-2019, 02:39 AM   #1
Cark
Newly Registered User
 
Join Date: Dec 2016
Posts: 95
Thanks: 47
Thanked 1 Time in 1 Post
Cark is on a distinguished road
How do I tell MS Access to look for a Text Box on a Page?

I have a Form which has 2 Tabs which contain separate aspects of information that are related to the same PartID.

What I am trying to do is to come up with a method so that if there is a Description entered into the Reliability Tab (and the Decription Part ID value on the Reliability Tab has a value) then the Text Box on the General Information Tab called Reliability Programme Present?: should show YES.

The way the user would input the data would be:
  1. Enter the Part ID at the top e.g 7155
  2. On the General Information Tab the user would enter a Description e.g TEST 7155
  3. The user would then go to the Reliability Tab and then enter a Description e.g TEST RELIABILITY.
  4. The user would then go back to the General Information Tab and should be able to see the "Reliability Programme Present?:" Box filled with YES.

I have been fumbling around and something like the code below should work, but it gives me issues whenever I click on the Reliability Tab as Me.ReliabilityProgrammePresent is only present on the General Information Tab and not on the Reliability Tab.

Code:
    If Parent.PartID = Me.PartID Then
    
        Me.ReliabilityProgrammePresent = "YES"
        
    End If
Any way to resolve this? What about the idea of identifying whether Me.ReliabilityProgrammePresent is on the Tab or not?

I am not too familiar with Page properties.

Happy to talk it through if there are any questions.
Attached Images
File Type: png Capture.PNG (66.5 KB, 11 views)
Attached Files
File Type: accdb ReliabilityProgrammeIdentifier.accdb (1.01 MB, 14 views)

Cark is offline   Reply With Quote
Old 07-12-2019, 03:05 AM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,203
Thanks: 57
Thanked 2,313 Times in 2,219 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: How do I tell MS Access to look for a Text Box on a Page?

You do it on the Change event of the tab control:
Code:
Private Sub TabCtl12_Change()
    
    If Me.TabCtl12.Value = 0 Then
        If Trim(Me.FrmSubReliability.Form!Description & "") = "TEST RELIABILITY" And _
                (Me.FrmSubCoverInformation.Form!ReliabilityProgrammePresent & "") <> "YES" Then
            Me.FrmSubCoverInformation.Form!ReliabilityProgrammePresent = "YES"
            
        End If
    End If
End Sub
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 07-12-2019, 03:36 AM   #3
Cark
Newly Registered User
 
Join Date: Dec 2016
Posts: 95
Thanks: 47
Thanked 1 Time in 1 Post
Cark is on a distinguished road
Re: How do I tell MS Access to look for a Text Box on a Page?

Hi Arnel,

I tried putting your snippet of code, but it did not seem to work.

Also the Description boxes will have different text for each part number so I don't think the code should involve these as hard coded items.

I have a feeling something like "If Parent.PartID = Me.FrmSubReliabilityProgramme.Form!PartID Then" might be useful.

Thoughts?

Cark is offline   Reply With Quote
Old 07-12-2019, 06:40 AM   #4
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,203
Thanks: 57
Thanked 2,313 Times in 2,219 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: How do I tell MS Access to look for a Text Box on a Page?

just add the condition to our expression:
Code:
Private Sub TabCtl12_Change()
    
    If Me.TabCtl12.Value = 0 Then
        ' check if both subform's PartID has value
        ' and that both values are the same.
        ' check also the field Description in the subform
        ' on Page "Reliability" has some text in it
        '
        ' if all are true, then finally check if the
        ' ReliabilityProgrammePresent has already been set
        ' to Yes. If not set it, otherwise, ignore.
        '
        If Nz(Me.FrmSubReliability.Form!PartID, 0) <> 0 And _
           Nz(Me.FrmSubCoverInformation.Form!PartID, 0) <> 0 And _
           Nz(Me.FrmSubReliability.Form!PartID, 0) = _
           Nz(Me.FrmSubCoverInformation.Form!PartID, 0) And _
           Trim(Me.FrmSubReliability.Form!Description & "") <> vbNullString And _
            (Me.FrmSubCoverInformation.Form!ReliabilityProgrammePresent & "") <> "YES" Then
            Me.FrmSubCoverInformation.Form!ReliabilityProgrammePresent = "YES"
            
        End If
    End If
End Sub
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 07-15-2019, 02:53 AM   #5
Cark
Newly Registered User
 
Join Date: Dec 2016
Posts: 95
Thanks: 47
Thanked 1 Time in 1 Post
Cark is on a distinguished road
Re: How do I tell MS Access to look for a Text Box on a Page?

Hi Arnel,

Can you explain why the Me.FrmSubReliability.Form!PartID part works? Why does it not need to be Me.FrmSubReliabilityProgramme.Form!PartID?

I have another SubForm called FrmSubFinanceProgramme and have tried copying the the fields over to use the following code, but it does not seem to be working:

Code:
        If Nz(Me.FrmSubFinance.Form!PartID, 0) <> 0 And _
           Nz(Me.FrmSubCoverInformation.Form!PartID, 0) <> 0 And _
           Nz(Me.FrmSubFinance.Form!PartID, 0) = _
           Nz(Me.FrmSubCoverInformation.Form!PartID, 0) And _
           Trim(Me.FrmSubFinance.Form!Description & "") <> vbNullString And _
            (Me.FrmSubCoverInformation.Form!FinanceProgrammePresent & "") <> "YES" Then
            Me.FrmSubCoverInformation.Form!FinanceProgrammePresent = "YES"
        End If
Similar to Reliability having a Page/Tab called Reliability, Finance has a Page/Tab called finance.

Let me know if you need further information.
Cark is offline   Reply With Quote
Old 07-15-2019, 04:52 AM   #6
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,203
Thanks: 57
Thanked 2,313 Times in 2,219 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: How do I tell MS Access to look for a Text Box on a Page?

it is simple, both subform's are linked to main form via their PartID field.
therefore both subform must have the same PartID.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 07-15-2019, 06:02 AM   #7
Cark
Newly Registered User
 
Join Date: Dec 2016
Posts: 95
Thanks: 47
Thanked 1 Time in 1 Post
Cark is on a distinguished road
Re: How do I tell MS Access to look for a Text Box on a Page?

If the Tab Page Name was something with a space e.g Customer Support would I use Customer_Support or [Customer Support] in the place where Reliability is?

Cark is offline   Reply With Quote
Old 07-15-2019, 10:00 AM   #8
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,203
Thanks: 57
Thanked 2,313 Times in 2,219 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: How do I tell MS Access to look for a Text Box on a Page?

it doesn't matter the name of the Tab Page.
The subform's are only Hosted by the Pages, BUT, they are member of the Main form.
so you refer then as:

Code:
Me.SubformName.Form!PartID
or simply:
Code:
[SubformName].Form!PartID
Me there refers to the Main form itself.

__________________
"Never stop learning, because life never stops teaching"
arnelgp 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
Login Page usings Data Access page / HTML ravi.firedup General 0 10-04-2013 06:58 AM
1 page report with 2nd page showing only text message stephengrenfell Reports 1 09-25-2010 06:32 PM
Text won't fit in text box, auto flow to next page? PTRACER Reports 3 07-05-2008 01:25 PM
Data access page filter refresh the page taoge General 1 01-01-2008 08:49 PM
Populate Text box on Web page geoffcodd Modules & VBA 0 03-08-2005 04:57 AM




All times are GMT -8. The time now is 09:15 PM.


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