473,395 Members | 1,987 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,395 software developers and data experts.

Select Case question

I have a form that acts a filter. All of the filtering objects are in
the header and the results are displayed in a continuous form in the
detail section.

In the header, I have a text box (txtCountRecords) with the control
source ="Your filter returned " & Count(*) & " units." Everything
works great until I clear the filter and null out all of the objects
in the header. Here is the code for that:

Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show
all records again.
Dim ctl As Control

'Clear all the text and combo boxes in the Form Header section.

For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next

'Clear the list boxes with the public function fSelectAll.
Call fSelectAll(Me.lstCustomer, False)
Call fSelectAll(Me.lstPartNo, False)
Call fSelectAll(Me.lstPriority, False)
Call fSelectAll(Me.lstWIP, False)

'Reset the value of the Record Source combo box.
Me.cboRecordSource.Value = "All Unshipped Units"

'Remove the form's filter.
Me.Filter = "(False)"
Me.FilterOn = True
Me.txtCountRecords.Visible= False

End Sub

This is the portion of code that keeps failing.

For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null

I can not null out the text box for counting records. I can only guess
it's because I have a function in the control source. That's fine.
What I really want to do is exclude this one text box from being
evaluated by the Select Case statement. The name of the text box is
txtCountRecords. How do I do this?

Thanks in advance.

Troy Lee
Sep 5 '08 #1
4 4674
ARC
Couldn't you do this?:

Select Case ctl.ControlType
Case acTextBox, acComboBox
if ctl.name <"txtCountRecords" then
ctl.Value = Null
end if
Case acCheckBox
ctl.Value = False
End Select
<tr******@comcast.netwrote in message
news:68**********************************@i76g2000 hsf.googlegroups.com...
>I have a form that acts a filter. All of the filtering objects are in
the header and the results are displayed in a continuous form in the
detail section.

In the header, I have a text box (txtCountRecords) with the control
source ="Your filter returned " & Count(*) & " units." Everything
works great until I clear the filter and null out all of the objects
in the header. Here is the code for that:

Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show
all records again.
Dim ctl As Control

'Clear all the text and combo boxes in the Form Header section.

For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next

'Clear the list boxes with the public function fSelectAll.
Call fSelectAll(Me.lstCustomer, False)
Call fSelectAll(Me.lstPartNo, False)
Call fSelectAll(Me.lstPriority, False)
Call fSelectAll(Me.lstWIP, False)

'Reset the value of the Record Source combo box.
Me.cboRecordSource.Value = "All Unshipped Units"

'Remove the form's filter.
Me.Filter = "(False)"
Me.FilterOn = True
Me.txtCountRecords.Visible= False

End Sub

This is the portion of code that keeps failing.

For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null

I can not null out the text box for counting records. I can only guess
it's because I have a function in the control source. That's fine.
What I really want to do is exclude this one text box from being
evaluated by the Select Case statement. The name of the text box is
txtCountRecords. How do I do this?

Thanks in advance.

Troy Lee
Sep 5 '08 #2
On Sep 5, 12:04 pm, "ARC" <PCES...@PCESoft.invalidwrote:
Couldn't you do this?:

Select Case ctl.ControlType
Case acTextBox, acComboBox
if ctl.name <"txtCountRecords" then
ctl.Value = Null
end if
Case acCheckBox
ctl.Value = False
End Select

<troy_...@comcast.netwrote in message

news:68**********************************@i76g2000 hsf.googlegroups.com...
I have a form that acts a filter. All of the filtering objects are in
the header and the results are displayed in a continuous form in the
detail section.
In the header, I have a text box (txtCountRecords) with the control
source ="Your filter returned " & Count(*) & " units." Everything
works great until I clear the filter and null out all of the objects
in the header. Here is the code for that:
Private Sub cmdReset_Click()
'Purpose: Clear all the search boxes in the Form Header, and show
all records again.
Dim ctl As Control
'Clear all the text and combo boxes in the Form Header section.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next
'Clear the list boxes with the public function fSelectAll.
Call fSelectAll(Me.lstCustomer, False)
Call fSelectAll(Me.lstPartNo, False)
Call fSelectAll(Me.lstPriority, False)
Call fSelectAll(Me.lstWIP, False)
'Reset the value of the Record Source combo box.
Me.cboRecordSource.Value = "All Unshipped Units"
'Remove the form's filter.
Me.Filter = "(False)"
Me.FilterOn = True
Me.txtCountRecords.Visible= False
End Sub
This is the portion of code that keeps failing.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
I can not null out the text box for counting records. I can only guess
it's because I have a function in the control source. That's fine.
What I really want to do is exclude this one text box from being
evaluated by the Select Case statement. The name of the text box is
txtCountRecords. How do I do this?
Thanks in advance.
Troy Lee
So simple. No wonder I missed it.Thanks.

Troy
Sep 5 '08 #3
On Sep 5, 12:49 pm, troy_...@comcast.net wrote:

if ctl.name <"txtCountRecords" then
ctl.Value = Null

I tried this and Access tells me I can't assign a value to this
object. Any ideas?

Troy
Sep 5 '08 #4
ARC
Looks like you need to reference the form first, something like:

me(ctl.Name).name

<tr******@comcast.netwrote in message
news:a6**********************************@d1g2000h sg.googlegroups.com...
On Sep 5, 12:49 pm, troy_...@comcast.net wrote:

if ctl.name <"txtCountRecords" then
ctl.Value = Null

I tried this and Access tells me I can't assign a value to this
object. Any ideas?

Troy
Sep 5 '08 #5

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

Similar topics

10
by: Lakshmi Narayanan.R | last post by:
Hi Experts, Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?. <% Dim Number1 Number1 = 7 ' Initialize...
2
by: JMCN | last post by:
hello i have your basic select case question. i created a combo box and save it as a query. so whenever the user selects the value and clicks the export button, the select case should then export...
7
by: Lauren Quantrell | last post by:
Is there any speed/resource advantage/disadvantage in using Select Case x Case 1 Case 2 etc. many more cases... End Select VS.
3
by: Starbuck | last post by:
Hi I am converting a app from VB6 to C# and I was wondering if anyone can tell me how to implement the following in c# case 207 To 252 Thanks in advance
16
by: ME | last post by:
In C# the following code generates a compiler error ("A constant value is expected"): public void Test(string value) { switch (value) { case SimpleEnum.One.ToString(): MessageBox.Show("Test...
6
by: mabond | last post by:
Hi Is it possible to compare a vaule for a select case statement using a wildcard. e.g. somthing like Select case myValue case like "*ing" end select
6
by: Spam Catcher | last post by:
Does anyone know why this doesn't work: Select Case X Case X or Y msgbox("hello world!") End Select It seems X or Y doesn't evaluate correctly (I think only the first 1/2 is
14
by: aa | last post by:
Code like this ======================= Select case q Case "a" Dim arr(5) Case "b" Dim arr(2) end select ===================== returns an error saying variable arr redefined.
21
beacon
by: beacon | last post by:
Hello to everybody, I have a section on a form that has 10 questions, numbered 1-10, with 3 option buttons per question. Each of the option buttons have the same response (Yes, No, Don't know),...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.