CALL UP CONTROL ON SUBFORM

FJM-P

New member
Local time
Today, 03:22
Joined
Aug 23, 2021
Messages
5
I have a main form called SALESORDERNUMBER which contains a subform called DETAILS.
On the mainform is a control named TESTNUMBER. This has 2 values to choose from. Either TP25A or TP68
On the subform is a control called STS1 which has a label called label22
I want to make the control and label on the subform visible when the value shown in TESTNUMBER is TP68 and not visible when the value shown is TP25A.
I have done similar before, but never with a subform.
Struggling with the code.....can anyone point me in a direction
 
I found this earlier, but I still can't seem to work out the correct coding.....I tried quite a few combos but with no luck...
 
I found this earlier, but I still can't seem to work out the correct coding.....I tried quite a few combos but with no luck...
Perhaps you can post a copy of the db
 
You haven't shown us what you have tried that doesn't work. All of the referencing techniques shown on the site moke123 linked to are how you can reference controls on a sub form and they do work. Show us your code and as Bob just mentioned, a database sample makes it much easier to see exactly what we're dealing with and make sure you use the code tags to display it.
 
You can use conditional formatting for this. You could include a join to the mainform table in the RecordSource of the subform and select the TestNumber column.
 
Probably something like this. Need to call this from the main forms current event and the TestNumber after update event.
Code:
Public Sub ShowHide()
   if TestNumber = "TP68" then
    me.SubformControlName.Form.STS1.visible = true
  else
    me.subformControlName.form.STS1.visible = false
  end if
end sub

This assumes the label is attached. Also if continous then all instances show or hide.
 
.......Sorted now......thanks for the replies
 

Users who are viewing this thread

Back
Top Bottom