2 options based on result

F

fishqqq

Can someone tell me how to write an 'if' argument that would do the
following:

[field1] = predetermined date&time
[field2] = now()

i would like the program to compare the two fields and do the
following

if [field1]>[field2] then open [form1]
if [field 1]<[field2] then open [form2]

Can someone please help me get my head around this?

thanks
Steve
 
K

Ken Snell

If [field1] > [field2] Then
DoCmd.OpenForm "form1"
ElseIf [field1] < [field2] Then
DoCmd.OpenForm "form2"
Else
MsgBox "Values are equal"
End If
 
F

fishqqq

If [field1] > [field2] Then
    DoCmd.OpenForm "form1"
ElseIf [field1] < [field2] Then
    DoCmd.OpenForm "form2"
Else
    MsgBox "Values are equal"
End If
--

        Ken Snellhttp://www.accessmvp.com/KDSnell/








Can someone tell me how to write an 'if' argument that would do the
following:
[field1] = predetermined date&time
[field2] = now()
i would like the program to compare the two fields and do the
following
if [field1]>[field2] then open [form1]
if [field 1]<[field2] then open [form2]
Can someone please help me get my head around this?
thanks
Steve

Thanks Ken
 
F

fishqqq

If [field1] > [field2] Then
    DoCmd.OpenForm "form1"
ElseIf [field1] < [field2] Then
    DoCmd.OpenForm "form2"
Else
    MsgBox "Values are equal"
End If
--
        Ken Snellhttp://www.accessmvp.com/KDSnell/
news:2730d55b-0af5-477f-80f9-ab780ecf2c79@u15g2000yqi.googlegroups.com....
Can someone tell me how to write an 'if' argument that would do the
following:
[field1] = predetermined date&time
[field2] = now()
i would like the program to compare the two fields and do the
following
if [field1]>[field2] then open [form1]
if [field 1]<[field2] then open [form2]
Can someone please help me get my head around this?
thanks
Steve

Thanks Ken


Ken, i`m running into a problem now. Below is the code with the
correct field and form names

I`m really doing 2 steps here.

step1- update text1 to now()
step2- compare the value of text1 to locktrigger and act accordingly.

question is how do i separate the steps so this will run correctly


Private Sub Form_Load()
Text1 = Now()

If [locktrigger] > [Text1] Then
DoCmd.OpenForm "frmLogin1"
ElseIf [locktrigger] < [Text1] Then
DoCmd.OpenForm "terms"
Else
MsgBox "Values are equal"
End If
End Sub
 
K

Ken Snell

I don't understand your question about 'separating the steps'? Can you
elaborate on what that means?
--

Ken Snell
http://www.accessmvp.com/KDSnell/


If [field1] > [field2] Then
DoCmd.OpenForm "form1"
ElseIf [field1] < [field2] Then
DoCmd.OpenForm "form2"
Else
MsgBox "Values are equal"
End If
--
news:2730d55b-0af5-477f-80f9-ab780ecf2c79@u15g2000yqi.googlegroups.com...
Can someone tell me how to write an 'if' argument that would do the
following:
[field1] = predetermined date&time
[field2] = now()
i would like the program to compare the two fields and do the
following
if [field1]>[field2] then open [form1]
if [field 1]<[field2] then open [form2]
Can someone please help me get my head around this?
thanks
Steve

Thanks Ken


Ken, i`m running into a problem now. Below is the code with the
correct field and form names

I`m really doing 2 steps here.

step1- update text1 to now()
step2- compare the value of text1 to locktrigger and act accordingly.

question is how do i separate the steps so this will run correctly


Private Sub Form_Load()
Text1 = Now()

If [locktrigger] > [Text1] Then
DoCmd.OpenForm "frmLogin1"
ElseIf [locktrigger] < [Text1] Then
DoCmd.OpenForm "terms"
Else
MsgBox "Values are equal"
End If
End Sub
 

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

Top