IF . . . DON'T WORK

  • Thread starter Thread starter יריב החביב
  • Start date Start date
×

יריב החביב

Hello,

We have text box (Text57) on a form that we want it to indicate yes or no

if the max value (date) on a table equal to the value (date) on another

text box (monthfort) on the form.

I wrote the below code, but the indication's text boxs (Text57) show all

the time in the value "no", wether the date's are equal or not.

please help


Private Sub Form_Open(Cancel As Integer)

If """" & DMax("sacharmonth", "netoonim_mahlaka") & """" = Me.monthfort Then
Me.Text57.DefaultValue = 1
Else
Me.Text57.DefaultValue = 0
End If

end sub


.........THANK'S
 
hi,

יריב החביב said:
We have text box (Text57) on a form that we want it to indicate yes or no
if the max value (date) on a table equal to the value (date) on another
text box (monthfort) on the form.
DefaultValue is the wrong property. It is representing the value, which
is automatically assigned when adding a new record.
If """" & DMax("sacharmonth", "netoonim_mahlaka") & """" = Me.monthfort Then
Me.Text57.DefaultValue = 1
Else
Me.Text57.DefaultValue = 0
End If
This should work:

Dim MaxDate As String

MaxDate = """" & DMax("sacharmonth", "netoonim_mahlaka") & """"

If MaxDate = monthfort.Value Then
Text57.Value = "Yes"
Else
Text57.Value = "No"
End If


mfG
--> stefan <--
 
thank you stefan, but no mattar what is the date

in the text box (monthfort) - a specialy when MaxDate

is equal to the date in monthfort,

i get the "answer" (text57) "no".

the values are date's, maybe that what make the problem.
 
hi,

יריב החביב said:
thank you stefan, but no mattar what is the date
in the text box (monthfort) - a specialy when MaxDate
is equal to the date in monthfort,
Ah, what does

MsgBox monthfort.Value & vbCrLf & _
"""" & DMax("sacharmonth", "netoonim_mahlaka") & """"

display?

I assume your TextBox returns something different than used in the
String comparision.

mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top