IF value from column in subform

steve87bg

Registered User.
Local time
Today, 19:41
Joined
Jan 14, 2013
Messages
19
I have subform on my main form. Subform is showing as datasheet on my main form. I whant to if some value in my subform column "Stanje" is equal to "Jeste" to display msgbox. is that possible?:confused:
 
It's possible, but at what point do you want to trigger the message box?
 
at button click
 
Button is on main form and it opens report. But if there's a value Jeste in subform coluymn Stanje i whant to display msgbox
 
The On Click event of your button will look something like;

Code:
If Me!YourSubformName.Form!Stanje = "Jeste" Then
     MsgBox "Your Message Message"
Else
    [COLOR="Green"]'Insert your action here[/COLOR]
End If

Bookmark this link for future reference, it shows the correct syntax for referring to Forms, Subforms, their properties and controls from various relative locations.
 
I tried that code but it only works if the first value in subform column Stanje is equal to Jeste
 
What am i dooing wrong? :banghead:

Code:
Set rstSubForm = Forms![qpocetnostanje subform]![qpocetnostanje subform1].Form!Stanje.Recordset
Do While Not rstSubForm.EOF
If Me![qpocetnostanje subform1].Form!Stanje = "Ne žigosana" Then
MsgBox "Izveštaj NE SME da sadrži ne žigosanu robu. Molim Vas vratite se na pretragu baze i izaberite samo žigosanu robu.", vbInformation, "Greška"
Me.RealanIzvestaj.SetFocus

Exit Sub
Loop
 

Users who are viewing this thread

Back
Top Bottom