visible coding with condition

G

Guest

I have an invoice form that has text box's serialNumber, prefix, and part
number. (All Are Text)
On a specific line if the prefix is "QGS" I want only that line to allow
serialNumber to be visible. I changed the property of serialNumber to
visible = false and added code as follows;
Private Sub SerialNumber_AfterUpdate()
If Me.PrefixID = "QGS" Then
Me.SerialNumber.Visible = True
End If
End Sub
When I do that, the whole column becomes visible for serialNumber whether
or not prefixID is or is not = to "QGS"
 
R

RoyVidar

edward keith wrote in message
I have an invoice form that has text box's serialNumber, prefix, and part
number. (All Are Text)
On a specific line if the prefix is "QGS" I want only that line to allow
serialNumber to be visible. I changed the property of serialNumber to
visible = false and added code as follows;
Private Sub SerialNumber_AfterUpdate()
If Me.PrefixID = "QGS" Then
Me.SerialNumber.Visible = True
End If
End Sub
When I do that, the whole column becomes visible for serialNumber whether
or not prefixID is or is not = to "QGS"

You are using a continuous form, aren't you? Then you don't see many
controls, but multiple instances of the same control - what you do to
one instance, will happen to all ...

I think I'd recommend taking a look at conditional formatting from the
format menu for this. This wont allow for making a control invisible,
but you can alter the back color and fore color
 
G

Guest

I will try that, thanks

RoyVidar said:
edward keith wrote in message


You are using a continuous form, aren't you? Then you don't see many
controls, but multiple instances of the same control - what you do to
one instance, will happen to all ...

I think I'd recommend taking a look at conditional formatting from the
format menu for this. This wont allow for making a control invisible,
but you can alter the back color and fore color
 
A

Albert D.Kallal

Actaully, I don't see this as a problem.....

I certainly have a lot of continues forms where I set the controls 'enabled'
property on/off. While this actually makes all instances of the control go
disabled, I actually find this works quite well. I mean, when you move
to the next row, those columns that you enable, or disable can then
be set. So, you could set the controls visible property as you move
the cursor up/down through the

In fact, I actually PREFER the above behavior, as then during
data entry it is VERY easy to see that the column in question
is enabled.

In place of a VERY HARD TO READ checkerboard pattern of enabled, and
disabled boxes,
, you get a very nice enable/display view as I move the cursor up /down.

I have uploaded a gif animation of me navigating in a form, both of the two
screen shots will give you an idea of how this looks.

http://www.members.shaw.ca/AlbertKallal/HideColumn/index.htm
 
G

Guest

Albert thanks for the look,but two things. First, when I scroll down the
screen my computer crashes. Second, I need to see the code. Can you help?
Thank you!
Edward Keith
 
A

Albert D.Kallal

I use the on-current event to enalbe/disable the contorls....

Here is the code

If Me.cboAccountType = 2 Then ' inventory
Me.cboInventoryType.Enabled = True
Me.UnitPrice.Enabled = True
Else
Me.cboInventoryType.Enabled = False
Me.UnitPrice.Enabled = False
End If

And, for all of my continues forms, to make the up/down arrow keys work, you
can include the following code. Note that the following code is not
needed..but for the most part I just include the below code on most of my
continues forms...so the up/down arrow keys work like they do in a datasheet
view...or spreadsheet....



Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext

End Select

The above code goes in the forms keydown event..and thus MUST set the forms
keypreview = yes....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top