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

Deeper than conditional formatting... possible?

3
Okay, here goes.

Continuous forms... possibly the best feature of access. The only downside is this: the only way to have a conditional evaluation run on each record invididually is by conditional formatting... this poses a problem because it is extremely limited (no wildcards, cannot access controls other than the one the formatting is on, cannot perform evaluations other than the ones give... greater than, less than etc).

Is there a way, even if it involves cycling through each record via a for loop, to evaluate or even reference items on invididual lines...

Is there an array somewhere with each member of the 'master' control in it? If i say "chkbox.checked = true" then obviously ALL of the checkboxes will check (for as many records as you have showing on your continuous form)... this is not what i'm looking for. Is there a way to programmatically ONLY check one of them (obviously clicking on it would work, but given only the index number of that record, ie: checkbox[4].checked = true)?

Here is an example that, if solved, I could adapt easily to do what I want:

You have a continuous form, some text boxes with their datasources set etc... now in design mode (which you only see your 'template' record), you have a lable, not linked to anything... just with static text in it (lets call it lblTest) and set its caption to 'Test'. Now there are 20 records... I have 20 'rows' on this form and each of them has a label that says "Test" and a bunch of varying information in the other linked text boxes...

if I simply code ... lblTest.caption = "changeme" ... then all 20 labels will change to that.. is there a way to change, say, only the 4th row label's caption? programatically without resorting to conditional formatting?

Hopefully this is a hurdle that can be overcome because it is extremely limiting.
Nov 10 '06 #1
11 3462
NeoPa
32,556 Expert Mod 16PB
I'm not too sure what effect could be achieved, but try playing with the OnCurrent event.
This should enable you to format individual records, but I'm not too sure about all the rest.
Play with it and see what you can do.
Nov 11 '06 #2
missinglinq
3,532 Expert 2GB
My question is, how do you figure Continuous forms... possibly the best feature of access when it allows you to do nothing that you wish to do? Continuous forms are undoubtedly the worst feature (form-wise) for all the reasons you've enumerated!
Nov 11 '06 #3
PEB
1,418 Expert 1GB
Hi

If you want on each row have different label....

The best way is to have separate field in your database ie Label1

There you can determine what information should be like Label...

By default you introduce a value but if there is a record with a label that should be different you change the field..

In your Continious form instaed to use the Label Control use the Field Control that is locked, filled like a label...and don't has the focus... And on clicking on this field create a function that sets the focus to the respective field to be updated...


Hope this helps
Nov 11 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
Okay, here goes.

Continuous forms... possibly the best feature of access. The only downside is this: the only way to have a conditional evaluation run on each record invididually is by conditional formatting... this poses a problem because it is extremely limited (no wildcards, cannot access controls other than the one the formatting is on, cannot perform evaluations other than the ones give... greater than, less than etc).

Is there a way, even if it involves cycling through each record via a for loop, to evaluate or even reference items on invididual lines...

Is there an array somewhere with each member of the 'master' control in it? If i say "chkbox.checked = true" then obviously ALL of the checkboxes will check (for as many records as you have showing on your continuous form)... this is not what i'm looking for. Is there a way to programmatically ONLY check one of them (obviously clicking on it would work, but given only the index number of that record, ie: checkbox[4].checked = true)?

Here is an example that, if solved, I could adapt easily to do what I want:

You have a continuous form, some text boxes with their datasources set etc... now in design mode (which you only see your 'template' record), you have a lable, not linked to anything... just with static text in it (lets call it lblTest) and set its caption to 'Test'. Now there are 20 records... I have 20 'rows' on this form and each of them has a label that says "Test" and a bunch of varying information in the other linked text boxes...

if I simply code ... lblTest.caption = "changeme" ... then all 20 labels will change to that.. is there a way to change, say, only the 4th row label's caption? programatically without resorting to conditional formatting?

Hopefully this is a hurdle that can be overcome because it is extremely limiting.
If you just want to toggle between two label values then I would suggest creating two labels and making one of them invisible. Then put something like this in the Form_Current event.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Current()
  3.  
  4.     If <conditional statement> Then
  5.         Me.lblFirstLabelName.Visible = True
  6.         Me.lblSecondLabelName.Visible = False
  7.     Else
  8.         Me.lblFirstLabelName.Visible = False
  9.         Me.lblSecondLabelName.Visible = True
  10.     End If
  11.  
  12. End Sub
  13.  
  14.  
Nov 12 '06 #5
PEB
1,418 Expert 1GB
Or simply changing the label Caption like this:

If testvalue=testresult then
Me.lblFirstLabelName.Caption = "Les banans viennent de:"
Else
Me.lblFirstLabelName.Caption = "Les abricots sont:"

end if

If you just want to toggle between two label values then I would suggest creating two labels and making one of them invisible. Then put something like this in the Form_Current event.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Current()
  3.  
  4.     If <conditional statement> Then
  5.         Me.lblFirstLabelName.Visible = True
  6.         Me.lblSecondLabelName.Visible = False
  7.     Else
  8.         Me.lblFirstLabelName.Visible = False
  9.         Me.lblSecondLabelName.Visible = True
  10.     End If
  11.  
  12. End Sub
  13.  
  14.  
Nov 12 '06 #6
tg989
3
Or simply changing the label Caption like this:

If testvalue=testresult then
Me.lblFirstLabelName.Caption = "Les banans viennent de:"
Else
Me.lblFirstLabelName.Caption = "Les abricots sont:"

end if

I think that the form_current has some potential, I'll try it and see what happens!

btw the reason I said that continuous forms was possibly the best feature is because it would take you several weeks to make a datagrid in vb.net that gives you the same effect. Everything else that access has going for it, some other language/ide can do better.

PEB - your suggestion only works when you have 1 label... if you have several, ie: on a continuous form, you would find that it changes all the labels captions depending on that 1 if statement.
Nov 13 '06 #7
PEB
1,418 Expert 1GB
Yeap sure with this code:

Originally Posted by PEB
Or simply changing the label Caption like this:

If testvalue=testresult then
Me.lblFirstLabelName.Caption = "Les banans viennent de:"
Else
Me.lblFirstLabelName.Caption = "Les abricots sont:"

end if
But if you catch my previous idea... To create a field in your table, named label...

And programatically change it's content... The field used for label should change and only on the respective record!

I give garantees!

PLS belive me! ;)
Nov 18 '06 #8
MMcCarthy
14,534 Expert Mod 8TB
Yeap sure with this code:



But if you catch my previous idea... To create a field in your table, named label...

And programatically change it's content... The field used for label should change and only on the respective record!

I give garantees!

PLS belive me! ;)
That's a great idea PEB.
Nov 18 '06 #9
PEB
1,418 Expert 1GB
10x Mary :)
Nov 18 '06 #10
tg989
3
Thats cheating :)

besides, I was trying to avoid bloating my tables with excessive fields that can be calculated on the fly.

I have however found the solution. basically you set the datasource of a text box to

"=IIf( [someotherfield] = "whatever", 'code executed if true', 'code executed if false')

you can get pretty creative with what goes in there and as a result, change the values of fields that are not related...

this has alleviated the original problem with very acceptable results and if anybody else is up against this same wall, i'd be glad to post some more thorough source code and explainations.
Nov 20 '06 #11
MMcCarthy
14,534 Expert Mod 8TB
When you find solutions like this, particularly to conditional formatting it's always nice to post the full code so that anyone searching the question in the future can see the full solution.

It's a very nice idea.

Mary

Thats cheating :)

besides, I was trying to avoid bloating my tables with excessive fields that can be calculated on the fly.

I have however found the solution. basically you set the datasource of a text box to

"=IIf( [someotherfield] = "whatever", 'code executed if true', 'code executed if false')

you can get pretty creative with what goes in there and as a result, change the values of fields that are not related...

this has alleviated the original problem with very acceptable results and if anybody else is up against this same wall, i'd be glad to post some more thorough source code and explainations.
Nov 20 '06 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
4
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
8
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format...
0
by: Paul T. Rong | last post by:
I don't know why that I lost track of the post. I found it from the newsgroup and paste last two posts. Pieter Linden said: "To do this - use conditional formatting..." I didn' work it out....
1
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
2
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
4
by: midlothian | last post by:
Hello, I have conditional formatting set up on a subform based on a calculated value in the underlying query. For instance, if Sales are >$1000, the query displays "Yes," otherwise it displays...
10
by: Lyn | last post by:
Hi, I would like to make a bound text box not visible if it is empty (not just disable it). This option is not available from the standard conditional formatting feature (at least, not that I can...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
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:
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
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...

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.