SOLVED

Codice vba report con errore runtime 2424

Copper Contributor
Buongiorno ,
Ho un report access con delle caselle di testo al cui interno ci sono delle cifre.
Siccome in access non esistono figure a cerchio ho importato dei cerchi colorati che mi serve colorare a seconda del valore della cifra bella casella di testo. La formattazione condizionale funziona solo nelle caselle di testo e non sulle immagini.
Allora ho impostato un select case sull evento apertura report per far comparire il solo il cerchio del colore che mi interessa.
Mi spiego meglio..nel report ho inserito 4 palline colorate sotto forma di immagini ..una gialla una rossa una verde e una nera . Se l importo della casella e minore a 75% deve comparire solo la palla nera e così via all umentare della.percentuale.
Quindi select case me.testo20
Case is minore 75
Nero.visible= true
Giallo.visible= false
Verde.visible= false
Rosso.visible= false
Quando apro il report Mi dice errore di runtime 2424 impossibile trovare il membro o impossibile assegnare valore al controllo
Chi mi sa aiutare?
19 Replies

@Massimiliano_fois 

Did you import the images to be image library?

This seems an unnecessarily complicated approach. Why not just use conditional formatting for the back colour of the text boxes containing the number values?

 

OR....if you really must use circles...then you could use circular command buttons of different colours. ..though this would only work in report view

 

isladogs_0-1628007705045.png

 

Io uso access 2010 e non esiste nessun comando per inserire cerchi colorati...tu che versione di access stai usando?

@Massimiliano_fois 

The screenshot was done in Access 365 but the same functionality is in A2010 onwards:

Create a button and then go to the Control Formatting section in the Format menu

isladogs_0-1628068746512.png

Select the ellipse shape and make the button width = height to create a circle. Use the Shape Fill to select the colour you want. 

 

Its easy enough to do...but I still think its an overcomplicated approach. However its your choice!

 

Beh allora dimmi come posso.ottenere lo.stesso obiettivo con un metodo piu semplice ...
Comunque ho creato il pulsante ma le opzioni della scheda format rimangono indisponibili
Ecco
The control formatting should be enabled when the button created is selected.

As suggested in my original reply, I would just use conditional formatting for the back colour of the text boxes containing the number values
Si infatti ho fatto così..ma in realtà la text box ha forma rettangolare..purtroppo il.mio capo non vuole un rettangolo ma un cerchio ...un pallina:)))

@Massimiliano_fois 

Perhaps your boss thinks its quick and easy to do?
If he/she is really prepared for you to spend several hours getting this to work, then you will have to solve your original issue (error 2424) with making circular images visible/hidden or use circular buttons as described and in report view only.
Perhaps the error 2424 is just due to you incorrectly referring to the name of one or more images
It may be easier to manage if you import the images into the Image Gallery as below

isladogs_0-1628080327134.png

If you do this, the images will be stored as attachments in a hidden, system table MSysResources.

However, only do so if the image file sizes are small (or you will bloat the database)

 

Good luck

Avrei un altro quesito da chiederti visto che sei così gentile ...ho creato un report che ha come origine dati una query a campi incrociati parametrica .se inserisco questo report come sottoreport in un altro report non viene visualizzato.invece i sottoreport che hanno come origine Query non parametriche si vedono ..Sai dirmi perché?
best response confirmed by Massimiliano_fois (Copper Contributor)
Solution

@Massimiliano_fois 

One thing at a time if you don't mind...please post your crosstab query question in a new thread

 

I had a flash of inspiration based on something similar I've done in the past

So I have a solution for your report issue & I hope your boss is happy with the result!

 

isladogs_1-1628082474857.png

 

It will work in report view or print preview

The coloured circles are in fact a Webdings character which is a solid black circle by default

I've then applied conditional formatting to these depending on the value of the number field

 

isladogs_0-1628082301256.png

 

Chr(110) is in fact the letter 'n' in a standard font as you will see from  the enclosed query

 

Forgot to say that this solution means you can alter the circle size by just changing the font size
You can also get a similar effect using other shapes such as a star. Just choose a different character or another font such as Wingdings
Sai dirmi perché a me visualizza questa sequenza strana di immagini anziché il cerchio?
Ecco
You are looking at the report in design view. I used a query for the report with a bound field called Circle. The characters shown are the word Circle in Webdings font.
I could have omitted the query and just have used an unbound field on the report
The contents of the field i.e. the circle shape is displayed in report view / print preview
Io ho provato a inserire direttamente nel report il carattere wingdings e il cerchio appare con la lettera L..in struttura report mi fa vedere il cerchio correttamente ma come apro il report il cerchio diventa un altra figura..ti mando gli screenshot
Ecco
Sono riuscito a risolvere ..Non so perché ma nel mio pc va inserito Chr(108)..grazie sei stata gentilissima..ora lavoriamo al secondo quesito?
Strange. Obviously a language issue with regard to Webdings. For me Chr(108) is a four pointed 'star'.
Anyway, now you have a working solution, please mark the post where i did this as the best solution.

As already mentioned, please start a separate thread for your new question as its unrelated. it will get a wider audience so you'll probably get more responses
1 best response

Accepted Solutions
best response confirmed by Massimiliano_fois (Copper Contributor)
Solution

@Massimiliano_fois 

One thing at a time if you don't mind...please post your crosstab query question in a new thread

 

I had a flash of inspiration based on something similar I've done in the past

So I have a solution for your report issue & I hope your boss is happy with the result!

 

isladogs_1-1628082474857.png

 

It will work in report view or print preview

The coloured circles are in fact a Webdings character which is a solid black circle by default

I've then applied conditional formatting to these depending on the value of the number field

 

isladogs_0-1628082301256.png

 

Chr(110) is in fact the letter 'n' in a standard font as you will see from  the enclosed query

 

View solution in original post