473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Customise datasheet column visibility for different users - Problem with Case and Like

Kev
Hello Everyone,
I am attempting to customise subform datasheet columns for different
users by making them visible or not depending on which ward they are
in.
I am using the tag property on the controls, eg enter GW in the tag of
each column which staff from GW need to see.
However some controls need to be viewed by staff in more than one
ward. So I might need GW 1N to be placed in the tag property. I have
tried Case ctl.tag Like "*GW*" but it does not work.
does anyone have a suggestion of how I can rectify this or a better
way of achieving my goal?

Regards
Kevin

Private Sub DoctorsHandoverSheetSubform_Enter()
Dim ctl As Control
Dim frm As Form_DoctorsHandoverSheetSubform
If FieldChooserSwitch = 0 Then
Select Case Ward
Case "GW"
For Each ctl In DoctorsHandoverSheetSubform
Select Case ctl.Tag
Case ""
GoTo groh
Case ctl.tag Like "*GW*"
ctl.ColumnHidden = False

End Select
groh:
Next
Case "1E"
etc etc
End Select
FieldChooserSwitch = 1
Else
End If
End Sub

May 30 '07 #1
4 1424
Kev wrote:
Hello Everyone,
I am attempting to customise subform datasheet columns for different
users by making them visible or not depending on which ward they are
in.
I am using the tag property on the controls, eg enter GW in the tag of
each column which staff from GW need to see.
However some controls need to be viewed by staff in more than one
ward. So I might need GW 1N to be placed in the tag property. I have
tried Case ctl.tag Like "*GW*" but it does not work.
does anyone have a suggestion of how I can rectify this or a better
way of achieving my goal?

Regards
Kevin
Maybe use Instr instead.
For Each ctl In DoctorsHandoverSheetSubform
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
Next
May 30 '07 #2
Kev
Maybe use Instr instead.
For Each ctl In DoctorsHandoverSheetSubform
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
Next
Thanks for the reply Salad
It works on the first iteration but then gives me this error:

Object doesn't support this property or method (Error 438)

I'm not sure what this means.
Regards
Kevin

Jun 1 '07 #3
Kev wrote:
>>Maybe use Instr instead.
For Each ctl In DoctorsHandoverSheetSubform
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
Next


Thanks for the reply Salad
It works on the first iteration but then gives me this error:

Object doesn't support this property or method (Error 438)

I'm not sure what this means.
Regards
Kevin
That's odd. It would appear that one of your controls doesn't have a
Tag property. What I might do, for testing, is in the line just above
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
enter
msgbox ctl.Name
or
debug.print ctl.name

Or maybe enter before the For statment
Dim strCompare As String
strCompare = Me.Ward

And then again I don't know where you are calling this. Here's the For
line I use in one of my form's code modules
For Each ctl In Me.Controls

Since you've assigned the subform to variable frm, perhaps you can use
For Each ctl In frm.Controls
Jun 1 '07 #4
salad wrote:
Kev wrote:
>>Maybe use Instr instead.
For Each ctl In DoctorsHandoverSheetSubform
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
Next

Thanks for the reply Salad
It works on the first iteration but then gives me this error:

Object doesn't support this property or method (Error 438)

I'm not sure what this means.
Regards
Kevin
That's odd. It would appear that one of your controls doesn't have a
Tag property. What I might do, for testing, is in the line just above
ctl.ColumnHidden = (Instr(ctl.tag,Ward) 0)
enter
msgbox ctl.Name
or
debug.print ctl.name

Or maybe enter before the For statment
Dim strCompare As String
strCompare = Me.Ward
Then
ctl.ColumnHidden = (Instr(ctl.tag,strCompare) 0)
>
And then again I don't know where you are calling this. Here's the For
line I use in one of my form's code modules
For Each ctl In Me.Controls

Since you've assigned the subform to variable frm, perhaps you can use
For Each ctl In frm.Controls
Jun 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Keith Wilby | last post by:
I have a form which allows both form and datasheet views. My question is, is it possible to control the field (column) names in datasheet view? What happens at the moment is that the name is...
13
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any...
3
by: A Clark | last post by:
I have a subform that displays a datasheet. There are a couple of different queries that can be displayed in the datasheet. The queries are available in a combo box on the main form. The problem...
1
by: George Kandaz | last post by:
Steve, I posted a question to your last post almost a week ago, but never heard from you again. Please read my last message, as follows. Thanks. ...
5
by: deekay | last post by:
I want to allow users to resize and reposition columns of a datasheet but for a prompt to be brought up and only the layout only to be saved if they select "save changes". This is the way it works...
14
by: fh217 | last post by:
Hi I have a datasheet with 32 columns, the first 2 columns are frozen and disabled. What I would like to do is as a user tabs thru a row on the sheet is to shift the sheet to the left so it...
1
by: tom taol | last post by:
Currently, there are 3 datasheets in a form. and, i changed column widths of each form(datasheet type) by the way, there is not keep the column width in ms access. for example, i close the form,...
3
by: JML | last post by:
How do I able to locked users from pasting records from column datasheet to another column? My case is I have a form that has a check box that determines when it is checked, the subform datasheet...
4
by: RussCRM | last post by:
I have a subform in datasheet form with the fields Date, Type and Note (sorted by Date). There are 4-5 records generally per date. Is there a way to group them visually somehow by date such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.