473,624 Members | 2,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing a control property according to record values

Hello i have a continuos form, and i have a command button to help
insert information on a control textbox. But when the text box is not
null, i dont want the command button to show (to the current record
only). What is the code i shall use in the Current Event of Form, in
order to display the command button for each record (for null related
text boxes).

Thanks in advance

Feb 2 '06 #1
4 3128
Access 2000 and newer has a Conditional Formatting option, but it doesn't
work for command buttons. While you can place code in the form's Current
event to make the button visible, the problem is that there is only one
button repeated multiple times. So, what will happen is the button will be
visible when the current record is Null, but it will be visible on all
records of the continuous form.

There are a couple of work-arounds.

1) You could place the button in the form's Header. This would give you only
one button on the form but it wouldn't scroll with the continuous part of
the form. The header part of the form will always be visible above the
detail part which is where the scroll is. You could make this button visible
or not in the form's Current event. It may work better to toggle its Enabled
property instead of its Visible property.

2) Conditional Formatting is available for textboxes. While it won't look
exactly the same, you could create a textbox that looks somewhat like a
button instead of the button. Set its Locked property to Yes and its Enabled
property to No. Use Conditional Formatting to change the Fore and Back Color
properties of the textbox to make them the same as the back color of the
form in order to hide the textbox when the associated field's value isn't
Null. Use the Click event of this textbox to run the code. The "caption" of
the textbox would be a calculated value in the Control Source (example:
="Click Me") and set the alignment property of the textbox to Centered.

--
Wayne Morgan
MS Access MVP
"Francis" <fr**********@m sn.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
Hello i have a continuos form, and i have a command button to help
insert information on a control textbox. But when the text box is not
null, i dont want the command button to show (to the current record
only). What is the code i shall use in the Current Event of Form, in
order to display the command button for each record (for null related
text boxes).

Thanks in advance

Feb 2 '06 #2
Very Good :)

Hm that really was what i was expecting, but there has to be a way to
change a given control property in a continuos form (a bit like
condiional formating). The thing is the command button is a pop up
calendar that helps the user to insert dates, but if a date is already
inserted in the text box i dont want it to change.

Your workaround was an option, in this case i have the text box:
txtDate with conditional formating to be disabled if it's value is not
null. The problem is even if it is disabled, the commmand button cmdCal
can overrun the disable, because the command button changes the txtBox
control source programatically .

what i will try now is to insert on the Click Event of the command
button an If clause, that checks if txtDate is disabled, if this is
right it just pops up a msgbox saying u can't change txtbox value.

Francis(portuga l)

Feb 2 '06 #3
The comment about a textbox wasn't to disable your current textbox, it was
to use an addition textbox in lieu of the button. Another option would be to
set the DoubleClick event of your current textbox to open the calendar
instead of using a separate control for this.

--
Wayne Morgan
MS Access MVP
"Francis" <fr**********@m sn.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
Very Good :)

Hm that really was what i was expecting, but there has to be a way to
change a given control property in a continuos form (a bit like
condiional formating). The thing is the command button is a pop up
calendar that helps the user to insert dates, but if a date is already
inserted in the text box i dont want it to change.

Your workaround was an option, in this case i have the text box:
txtDate with conditional formating to be disabled if it's value is not
null. The problem is even if it is disabled, the commmand button cmdCal
can overrun the disable, because the command button changes the txtBox
control source programatically .

what i will try now is to insert on the Click Event of the command
button an If clause, that checks if txtDate is disabled, if this is
right it just pops up a msgbox saying u can't change txtbox value.

Feb 2 '06 #4
Thanks for your info it's working now

I just added a condition to the click event, and it won't open cal if
the value is not null. Thanks.

Feb 3 '06 #5

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

Similar topics

3
2430
by: PAUL EDWARDS | last post by:
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be updated in the database, however if I update the text property of the control from code it is 50% chance that the update will make it back to the dataset. If I update the dataset instead of the form, it does not show on the form. Is there a method that should be used?
6
3396
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
2
3741
by: John Hargrove | last post by:
I'm having trouble setting decimal place values in the results field of a sample management database I'm building for an environmental testing laboratory. The degree of sensitivity varies among test methods; consequently, some results are reported to 2 decimal places, some to 3, etc. The Results subform consists of Test Parameter, Result, Report Unit, Analysis Date, Analyst and other fields. The test parameter control is a drop-down...
2
2621
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the form is opened. After the user selects the contact from an unbound combobox I want the form to be rebound to its recordsource. I tried using form.recordsource = "Contacts" in the afterupdate event of
6
2735
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control runat="server" id="mcTwo" Flag="Two" />
0
1580
by: deepak | last post by:
Hi all, i m transefering values from one listbox to another listbox using javascript(both are html controls), the first listbox is populating with database at page_load time and the second listbox is empty initially .the two buttons which i have taken are both(btnAd,btnRemove) have values Add,Remove and both are input type with run as server control property set to true,.my script is given below , however when i click on add button the ...
5
2803
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For instance, using the IExtenderProvider interface, you can specify properties, but there is nothing documented about linking into a control's events. For instance, in my application, there are specific formatting, functionality and validation for...
32
3662
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's RecordSource like this? Am I asking for trouble doing this with a memo field? Thanks in advance. Private Sub cmdNextNote_Click() Dim lngNid As Long If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
8
28528
by: Steve | last post by:
Hi All Is there a way to change the colour of a Groupbox border in VB.net 2005 I want to change it to white Can it be done in the onpaint event? Regards Steve
0
8246
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8490
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4184
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1489
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.