If does not work in subforms????

rui_jc

Registered User.
Local time
Today, 20:27
Joined
Aug 17, 2005
Messages
10
Greetings to all,

can you help me with this?

I have a main form linked with a subform ( m/child ) query and I'm trying to make this code to work but it does not and I don’t know why.

I have this code…

Me.Form![subform1]![type] = Me.Combo12
Me.Form![subform1]![DESIGN] = Me.Combo11
Me.Form![subform1]![stage] = "NEW"
Me.Form![subform1]![stagedate] = Now()

...and it works, but when I do this…

If Me.Form![subform1]![stage] <> "NEW" Then
Me.Form![subform1]![type] = Me.Combo12
Me.Form![subform1]![DESIGN] = Me.Combo11
Me.Form![subform1]![stage] = "NEW"
Me.Form![subform1]![stagedate] = Now()
End If

It does not work, can anyone tell me why the If does no work ??????

Many thanks in advance
 
Does these codes work for access 2002 ????

After writing the code...

If Me.subform1.Form!stage <> "NEW" Then
Me!subform1.Form!stage = "NEW"
Me!subform1.Form!stagedate = Now()
End If

It's the same as I have...

'If Me.subform1.Form!stage <> "NEW" Then
' Me!subform1.Form!stage = "NEW"
' Me!subform1.Form!stagedate = Now()
'End If

It still does not work !

Any ideas???
 
No error, nothing. It just doesnt want to write...
 
Put a TextBox on your main form as a diagnostic. Set it's ControlSource to:
=subform1.Form!stage and see what shows up in the textbox. Where are you running this code? In what event?
 
With a message box...

If Me.Form![Datain subform1]![stage] = "new" Then
'Me.Form![Datain subform1]![stage] = "old
MsgBox " new"
End If

does not apear any msg. It's like it's not detecting or the if is not working.
I have the subform and it's data visible for testing and i can see that the "NEW" is there !

i'm running this code in the save record button...
Private Sub Comando38_Click()
 
Please do this:
Put a TextBox on your main form as a diagnostic. Set it's ControlSource to:
=subform1.Form!stage and see what shows up in the textbox.
We need to see what shows up in the TextBox!
 
I got it...

simply changed the way the condition is typed...

before...

If Me.Form![stage change]![stage] <> "NEW" Then
Me.Form![stage change]![datein] = Me.DATA
end if

DID NOT WORK

But i tryed this...

If Me.Form![stage change]![stage] = "NEW" Then GoTo jump
Me.Form![stage change]![datein] = Me.DATA
jump:

And now it works... :rolleyes: But i still dont know why the first way does not work !!!!

Have any ideas???
 

Users who are viewing this thread

Back
Top Bottom