option radiobutton pass a value to another form in letter

raphael99

Registered User.
Local time
Yesterday, 16:41
Joined
Apr 6, 2015
Messages
126
Hi I'm going to select case 1 to pass that value (in letter "M") to another form textbox:
I'm trying with no avail the following:

Code:
Private Sub radioUomo_GotFocus()
' radiobutton

Dim strUomo As String

Select Case radioUomo

Case 1
strUomo = Forms!FRMnuovoPaziente.Sesso.M
Case*2:
strUomo = Forms!FRMnuovoPaziente.Sesso.["Fail"]
End Select
End Sub

The code passing debug but not pass the letter M to the other form
 
The the references Forms!FRMnuovoPaziente.Sesso.M and Forms!FRMnuovoPaziente.Sesso.["Fail"] don't look right and you are assigning them to a string strUomo and then doing nothing with it. This code doesn't make any sense.

I suggest you upload your database and give us a clearer explanation of what you want to do.
 
In the Frame Sesso there are two radio button.
When selected the Uomo I would like to write an M on another textbox in another form
When selected the Donna I would like to write an F on another textbox in another form
 

Attachments

The frame in which you have the option button gets the values of the option buttons. So that's what you want to test in your case statement. Also the afterupdate of the frame seems to be a better event for this. So assuming the other form is named FRMnuovoPaziente with a text box name Text0 this code would do what you said

Code:
Private Sub Sesso_AfterUpdate()

Select Case Sesso

Case 1
    Forms!FRMnuovoPaziente!Text0 = "M"
Case 2
    Forms!FRMnuovoPaziente!Text0 = "F"

End Select

End Sub


For this to work both forms need to be open. You can try this in the attached database.
 

Attachments

Last edited:
@sneuberg.
The code is right and it works, but there is a question that "Uomo" or "Donna" must selected before than "calcola".
Infact when I press "calcola" all the data in form FRMNuovoPaziente are filled.
All is done by that button.
Any hint?
 
ahhhhhh. put it in before update and it works like a charm.
Many thanks
 
No sorry to be in hurry.
There are some point I must clear:
When I press Calcola it populated the form nuovo paziente but then it closed the form so the next command from subroutine to update Sesso does not works.
I should populated also sesso before push calcola
 
What's Sesso? Isn't that the frame? What do you mean by update it? What you you mean by pushing calcola?

Having one form update another isn't usually done. Why are you doing this? Why don't you just put the controls (textbox, etc) that are on the FRM_Calcolo Codice Fiscale Raffy on the FRM_Calcolo Codice Fiscale Raffy to start with?
 
Code:
 If Sesso.Value = 1 Then
    Forms!FRMnuovoPaziente!Sesso.Value = "M"
     ElseIf Sesso.Value = 2 Then
    Forms!FRMnuovoPaziente!Sesso.Value = "F"
    End If
I solved this way:

Thanks anyway for hint
 

Users who are viewing this thread

Back
Top Bottom