How to make a subform inactive??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,
I have asked a similar question but i have changed my database a bit and I could really use help
Here is the situation

I have a form named Record Retention and a subform that is named Gap Analysis. I have gathered information from a whole bunch of users. Sometimes the users have entires on the Gap Analysis Subform and sometimes they do not. If they do I have linked it so that like entries are displayed together by making a field I call the Gap Refrence Code. The Gap refrence code will pull each the record from the form and the subform and show it toether. When there is no Gap Analysis entry I have placed the words "NO GAP" in the Gap Refrence code field. ( in both the form and subform)

I am wondering how I can make it so whenever I have the words NO GAP in the Form, I can make the Subform become inactive ( a grey color). The Gap Refrence Code displays " NO GAP" in both the Record Retention Form and the Gap Analysis subform -- PLEASE HELP -- thanks in advance.
 
Hi Rich,

It might be easier to hide the subform since even when it it is disabled it
will still show the value of the linking field in the subform.

Me.sfrmGapAnalysis.Enabled = Me.GapReferenceCode <> "NO GAP"
'or
Me.sfrmGapAnalysis.Visible = Me.GapReferenceCode <> "NO GAP"
 
If your main form has a text box that contains the
phrase "NO GAP" then you should be able to use the main
form's On Current event to disable the subform. For
example:

Sub MainForm_On_Current()

If me.textbox1.value="NO GAP" then
me.subform.enabled=false
else
me.subform.enabled=true
end if

End sub

Something like this should work just fine.
 
Thanks Jeff.. now one last questin .. is there any way that I can get the inactive part to display a .bmp file? or just simple text letting the user know that there is no entr

much thanks in advance
 
Yes, you can do either or both. In form design view add
a .bmp file to the form using a picture box or similar
control and/or add a label that says "No Gap Data
Available" and set their Visible properties to false.

Add the following code to the on current event I mentioned
before.

If me.textbox1.value="NO GAP" then
me.subform.enabled=false
me.bitmap.visible=true
me.label.visible=true
else
me.subform.enabled=true
me.bitmap.visible=false
me.label.visible=false
end if
 
hmmmm. This does not seem to be working. I am able to get the subform to become inactive but i am not able to make the .bmp file show up. I have named it
Inactive.bmp
and
the Record Retention form the field that triggers the inactive subform is Gap Refrence Code. I am placing this code in the OnCurrent field in the form
 
This might have to do with the order of the picture. Objects on a form are
placed on top of each other. If your subform is on top of your image, then
changeing the visible property of the image won't matter since it will be
covered by the subform. In the form design select the image object and move
it to the top. This way when it is visible, it will appear over the
subform.

Another option is to leave it behind the subform and just make the subform
go invisible. Then your image will show through the invisible subform.
When the subform is visible it will hide the image.

Kelvin

Rich said:
hmmmm. This does not seem to be working. I am able to get the subform to
become inactive but i am not able to make the .bmp file show up. I have
named it
Inactive.bmp
and
the Record Retention form the field that triggers the inactive subform is
Gap Refrence Code. I am placing this code in the OnCurrent field in the form
 
Back
Top