matching dates in unbound textbox problem

rob.low

Access Nutter
Local time
Yesterday, 23:58
Joined
Dec 27, 2007
Messages
96
hi all.

Wonder if some on can have a look at what I'm trying to do and point me in the right direction?

what i have is a form with 2 unbound text boxes both containing a date and what i need is if the dates both match then do one thing and if they don't match do something else.


IE:

if textbox1.value matches textbox2.value then
open form1
else
open form2


(both text box values are short dates)

thanks for your help on this :)

rob
 
Howzit

Try...

Code:
if me.textbox1= me.textbox2 then
     docmd.openform "yourform1"
else
     docmd.openform "yourform2"
end if
 
hi there
Thanks for the reply.

tryed the code you posted.
and it loads the second form not the first even though the dates do match? :confused:

thanks for your help with this
rob
 
Howzit

Need to test the values of both text boxes. When the vbwindow shows up make sure the immediate window is open, then step throguht the code using F8. Check what is shown in the immediate window once you have stepped through to if me.
Code:
stop
debug.print me.textbox1
debug.print me.textbox2

if me.textbox1= me.textbox2 then
     docmd.openform "yourform1"
else
     docmd.openform "yourform2"
end if
 
hi there

under each date it says null
see below

08/12/2008
Null
08/12/2008
Null


rob
 
Howzit

How do you actiate the event? Can you post your entire code please.

The text boxes definitely have dates in?

You can try...

Code:
If IsNull(Me.yourtext1) Or Me.yourtext1= "" or IsNull(Me.yourtext2) Or Me.yourtext2= "" Then
    MsgBox "no data in text box"
Else
    If Me.yourtext1 = Me.yourtext2Then
        DoCmd.OpenForm "yourform"
    Else
        DoCmd.OpenForm "yourform2"
    End If
End If
 
thanks for the help kiwiman all sorted now

thanks m8
rob
 

Users who are viewing this thread

Back
Top Bottom