PDA

View Full Version : Solved: userform...when click OK button ask if the input values are true if not put them agai



PaSha
12-17-2007, 05:21 AM
helo..

i made some code for my userform... which when the user clicks the OK button asks him if the values he puted into the inputbox are correct ...

the code looks like this :


Private Sub potrdibutton_Click()


Dim Config As Integer
Dim Ans As Integer
Dim Msg As String
Config = vbYesNo + vbQuestion + vbDefaultButton2
Msg = "Ali so naslednji vpisani podatki pravilni?" & vbCrLf & vbCrLf
Msg = Msg & "?tevilka produkta: " & produktbox & " " & vbCrLf
Msg = Msg & "?tevilka tipa: " & typbox & " " & vbCrLf
Msg = Msg & "?tevilka naloga: " & auftragsbox & ""
Ans = MsgBox(Msg, Config)
If Ans = vbYes Then ContinueProcedure = True _
Else
Exit sub

'the rest of the code for the ok button



OK this works, when he clicks a pop up windows ask's him if the code is true ... but i want that if the user clicks OK the other code in the button should run if he clicks NO button then he could repair his mistake in the form and then again click ok...

but i don't no how to do this ... i trayed with continue procedure and exit sub ... but it doesn't work ...

so hope someone can help me

Bob Phillips
12-17-2007, 05:34 AM
Private Sub potrdibutton_Click()
Dim Config As Integer
Dim Ans As Integer
Dim Msg As String

Config = vbYesNo + vbQuestion + vbDefaultButton2
Msg = "Ali so naslednji vpisani podatki pravilni?" & vbCrLf & vbCrLf
Msg = Msg & "Številka produkta: " & produktbox & " " & vbCrLf
Msg = Msg & "Številka tipa: " & typbox & " " & vbCrLf
Msg = Msg & "Številka naloga: " & auftragsbox & "" Ans =
MsgBox(Msg, Config)

If Ans = vbno Then

Exit Sub
Else

'the rest of the code for the ok button

PaSha
12-17-2007, 05:53 AM
oh ok, lol, i forgotten the answer no...

thank you...

solved...