Form processing with If (still looking for answer)

  • Thread starter Thread starter Wayne Veale
  • Start date Start date
W

Wayne Veale

First of all thanks for all info so far. I'm still trying to display one
form or another based on an If stmt in a ""close cmd button" from one form
that has finished data input. I have the following expression on the "close
form" button.
If [gift cert]![RECUPDATED] = -1 And [gift cert]![PJAMTFORCOUPN] >= 50 Then

DoCmd.OpenForm "PJ PRINT COUPON QUEST FRM"

Else

DoCmd.OpenForm "MAIN MENU"

End If

I've tried this on the "on click" for the button and on the "on close" for
the form. Does not work. What happens is the "PJ PRINT COUPON QUEST FRM"
ALWAYS displays either with the record from the correct condition, OR a .
record with Zero,no data. I never get back to the main menu I believe the
second (wrong) example is because the table the record is coming has a
"record to be added" in it with the zero/no data, in its fields. ( If I
display the table, the zero/ no data record is there.) See below of what's
in the table:

GC# DATE ORDERED LAST NAME FIRST NAME ADDRESS
+ 0001 05/28/2206 VEALE WAYNE
123 ANY ADDR

+ 0002 5/29/2006 JONES TOM
789 DOES NOT MATTER

* 0000 (THIS IS ZERO/NO DATA RECORD) (I believe for
addition)

I can't find how to stop the zero/no data record from affecting my If
statement.

I have tried many ways to try to get this to work with no success.

ANY help would be appreciated.

WWV
 
Assuming that [gift cert]![RECUPDATED] and [gift cert]![PJAMTFORCOUPN] are
controls on your form, change your code to:

If Me.RECUPDATED = -1 And Me.PJAMTFORCOUPN >= 50 Then

DoCmd.OpenForm "PJ PRINT COUPON QUEST FRM"

Else

DoCmd.OpenForm "MAIN MENU"

End If


--
hth,
SusanV

Wayne Veale said:
First of all thanks for all info so far. I'm still trying to display one
form or another based on an If stmt in a ""close cmd button" from one form
that has finished data input. I have the following expression on the
"close form" button.
If [gift cert]![RECUPDATED] = -1 And [gift cert]![PJAMTFORCOUPN] >= 50
Then

DoCmd.OpenForm "PJ PRINT COUPON QUEST FRM"

Else

DoCmd.OpenForm "MAIN MENU"

End If

I've tried this on the "on click" for the button and on the "on close" for
the form. Does not work. What happens is the "PJ PRINT COUPON QUEST FRM"
ALWAYS displays either with the record from the correct condition, OR a .
record with Zero,no data. I never get back to the main menu I believe the
second (wrong) example is because the table the record is coming has a
"record to be added" in it with the zero/no data, in its fields. ( If I
display the table, the zero/ no data record is there.) See below of what's
in the table:

GC# DATE ORDERED LAST NAME FIRST NAME ADDRESS
+ 0001 05/28/2206 VEALE WAYNE 123 ANY
ADDR

+ 0002 5/29/2006 JONES TOM 789
DOES NOT MATTER

* 0000 (THIS IS ZERO/NO DATA RECORD) (I believe
for addition)

I can't find how to stop the zero/no data record from affecting my If
statement.

I have tried many ways to try to get this to work with no success.

ANY help would be appreciated.

WWV
 
What are these?

[gift cert]![RECUPDATED]
[gift cert]![PJAMTFORCOUPN]

The logic to select a form to open is correct, but reference to the above
two objects is suspect.

Wayne Veale said:
First of all thanks for all info so far. I'm still trying to display one
form or another based on an If stmt in a ""close cmd button" from one form
that has finished data input. I have the following expression on the "close
form" button.
If [gift cert]![RECUPDATED] = -1 And [gift cert]![PJAMTFORCOUPN] >= 50 Then

DoCmd.OpenForm "PJ PRINT COUPON QUEST FRM"

Else

DoCmd.OpenForm "MAIN MENU"

End If

I've tried this on the "on click" for the button and on the "on close" for
the form. Does not work. What happens is the "PJ PRINT COUPON QUEST FRM"
ALWAYS displays either with the record from the correct condition, OR a .
record with Zero,no data. I never get back to the main menu I believe the
second (wrong) example is because the table the record is coming has a
"record to be added" in it with the zero/no data, in its fields. ( If I
display the table, the zero/ no data record is there.) See below of what's
in the table:

GC# DATE ORDERED LAST NAME FIRST NAME ADDRESS
+ 0001 05/28/2206 VEALE WAYNE
123 ANY ADDR

+ 0002 5/29/2006 JONES TOM
789 DOES NOT MATTER

* 0000 (THIS IS ZERO/NO DATA RECORD) (I believe for
addition)

I can't find how to stop the zero/no data record from affecting my If
statement.

I have tried many ways to try to get this to work with no success.

ANY help would be appreciated.

WWV
 
Thanks for the response. the two flds [RECUPDATED] and [PJAMTFORCOUPN] are
not a result of the form updating the table I need, so this will not work.
It is coming much clearer now. After an update qry to total flds I need into
the tbl I need, I believe I need to run the If cmd in a MACRO using a this
table (where these two flds are located,) then open either form based on the
If stmt. Can this be done? I tried it my "old way" and still had the
problem. Will the new suggestion work in a macro? I know this sounds
confusing, but it makes more sense to me with your comments and I think I'm
gettting close. Thanks
Wayne Veale said:
First of all thanks for all info so far. I'm still trying to display one
form or another based on an If stmt in a ""close cmd button" from one form
that has finished data input. I have the following expression on the
"close form" button.
If [gift cert]![RECUPDATED] = -1 And [gift cert]![PJAMTFORCOUPN] >= 50
Then

DoCmd.OpenForm "PJ PRINT COUPON QUEST FRM"

Else

DoCmd.OpenForm "MAIN MENU"

End If

I've tried this on the "on click" for the button and on the "on close" for
the form. Does not work. What happens is the "PJ PRINT COUPON QUEST FRM"
ALWAYS displays either with the record from the correct condition, OR a .
record with Zero,no data. I never get back to the main menu I believe the
second (wrong) example is because the table the record is coming has a
"record to be added" in it with the zero/no data, in its fields. ( If I
display the table, the zero/ no data record is there.) See below of what's
in the table:

GC# DATE ORDERED LAST NAME FIRST NAME ADDRESS
+ 0001 05/28/2206 VEALE WAYNE 123 ANY
ADDR

+ 0002 5/29/2006 JONES TOM 789
DOES NOT MATTER

* 0000 (THIS IS ZERO/NO DATA RECORD) (I believe
for addition)

I can't find how to stop the zero/no data record from affecting my If
statement.

I have tried many ways to try to get this to work with no success.

ANY help would be appreciated.

WWV
 
Back
Top