Value not showed in a form

spa856

New member
Local time
Today, 20:03
Joined
Apr 21, 2023
Messages
26
Dear

my situation:
  1. Main form F_RICERCA
  2. Sub Form F_ELENCO
  3. Button Istanza on the right
1682591852396.png


If I click on the button it opens the correct form, linked to my client, it seems all is ok but I have an issue with this field:

1682592101670.png

I set as default value on the table T_ISTANZA the value "N" for ISTANZA_CREATA, but the form dosn't show it as N
If I put into one of the fields a value it shows the value N.
It is a problem for me because I create a VBA code for the current event where if the field is equal to N the label Gestione Istanza is Create Istanza, otherwise Gestione Istanza. After the click it change value to Y and it works.
Do you have any ideas?
thank you
 
Default value is only for new records?
 
agree with Gasman - you need to update your existing records where the field is null (or a zls depending on your settings) to N or Y as required.

alternatively modify the code that does this

if the field is equal to N the label Gestione Istanza is Create Istanza

to

if the field is equal to N or null the label Gestione Istanza is Create Istanza

usual way to do this

if nz(myfield,"N")="N" then
 
In the table the value is N, only in the forms it blank.
If I put any values on the form, the field shows N (see screen): I put Modulo, and the field is equal to N and the label is Create Istanza.
I don't understand the reason.
1682597360762.png
 
better show your code since label captions don't change unless you use code
 
This is the code on current event of the subform.
This code works if I edit some information in the form, but when I open the form for the first time the field is empty till I edit some information.
Private Sub Form_Current()
Dim edit As String
Dim add As String

add = "Creare Istanza"
edit = "Gestione Istanza"
If Me.ISTANZA_CREATA = "N" Then
Me.Label15.Caption = add
Else
Me.Label15.Caption = edit
End If
End Sub
Here the code on click
Private Sub Label15_Click()
If Me.ISTANZA_CREATA = "N" Then
Me.ISTANZA_CREATA = "S"
End If
 
Last edited:
looks like you edited your current code from what I was posted - suggest try the suggestion I made

If nz(Me.ISTANZA_CREATA,"N") = "N" Then
 
Nothing, it doesn't work.
I've created a new record.
Ok, I find the error: the field is related to the table T_ISTANZA.
T_ISTANZA is a T_PUNTO_VENDITA's table, so the field will be populated when I create the Istanza.
How can I manage this field in T_PUNTO_VENDITA?

1682605725053.png


1682605773420.png

Ho
 

Attachments

  • 1682605714052.png
    1682605714052.png
    289.6 KB · Views: 108
Last edited:

Users who are viewing this thread

Back
Top Bottom