Why code will not work? 
Author Message
 Why code will not work?

Using Access97, have a form with three fields in it: REQ#, PO# and REQ Open.
REQ# is the primary field and is set to be read only.

I would like the REQ Open field to auto update to "N" if the PO# field is
greater than 0 and "Y" if the PO# is "0".  I put the following statement in
the after update in the
PO# AfterUpdate properties:

=IIf([PO#]>1,"Y","N")

But I get an error message... any ideas or other suggestion on how to do
this?

Thanks



Wed, 18 Oct 2000 03:00:00 GMT  
 Why code will not work?

Well, if I understand the question properly,  the code in the AfterUpdate of
PO# then should read something like

REQOpen=(PO#>1)
if you can live with -1 as true and 0 as False.  Or can change it to what
you already have if ReqOpen is a string field and you want to store Y/N.

HTH

--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

Quote:

>Using Access97, have a form with three fields in it: REQ#, PO# and REQ
Open.
>REQ# is the primary field and is set to be read only.

>I would like the REQ Open field to auto update to "N" if the PO# field is
>greater than 0 and "Y" if the PO# is "0".  I put the following statement in
>the after update in the
>PO# AfterUpdate properties:

>=IIf([PO#]>1,"Y","N")

>But I get an error message... any ideas or other suggestion on how to do
>this?

>Thanks



Wed, 18 Oct 2000 03:00:00 GMT  
 Why code will not work?

On Sat, 2 May 1998 13:24:00 -0400, "barryandbarb"

Quote:

>Using Access97, have a form with three fields in it: REQ#, PO# and REQ Open.
>REQ# is the primary field and is set to be read only.

>I would like the REQ Open field to auto update to "N" if the PO# field is
>greater than 0 and "Y" if the PO# is "0".  I put the following statement in
>the after update in the
>PO# AfterUpdate properties:

>=IIf([PO#]>1,"Y","N")

>But I get an error message... any ideas or other suggestion on how to do
>this?

>Thanks

Yes.  In the AfterUpdate event, use [event procedure] option.
You will need to write an event procedure to update the other text
field.  Like so...

Private Sub PO#_AfterUpdate()
  Dim strPO, strREQOpen As String

  Form![PO#].SetFocus
  strPO = Form![PO#].Text
  If CInt(strPO) > 1 Then
    strREQOpen = "Y"
  Else
    strREQOpen = "N"
  End If
  Form![REQ Open].SetFocus
  Form![REQ Open].Text = strREQOpen
End Sub

When the subroutine ends, the focus will be on the REQ Open text box,
and its value will be updated accordingly.
I've never had any luck with trying to use a procedure or function
like the one you used above, however, an alternative could be to try:
=( If Form![PO#} > 1, 'Y', 'N' )
Just saying 'PO#' in the equation may not make sense to Access, it may
not reference the PO# text box, it may be looking for a PO# field in a
table or something.

Peace Out,

Jason Dumler



Thu, 02 Nov 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why does the following code not work?

2. this code does not work, why?

3. Help Please...Code does not work why?

4. Why does this piece of code work with Word 97 but not Word 2000

5. why will this code not work

6. Find/Replace code not working - why?

7. Why this code does not work:

8. why the @#$@% does this code not work

9. Anyone know why this code only works in 32bit and not 16 bit vb 4

10. Why this code does not work properly?

11. Why does this code not work?

12. Why does this simple code not work?

 

 
Powered by phpBB® Forum Software