Undo 
Author Message
 Undo

Hi. I am trying to make sure that a field is completed
based on the data in another field.  Both of the fields
are on a subform.

Specifically, if combo81 (status type) is "1" (awarded)
then I want NextSubmittalDate to be required.

I'm trying:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If Combo81 = 1 Then
    'status is Awarded
    If Len(Trim$(NextSubmittalDate & vbNullString)) > 0
Then
    'there is something in NextSubmittalDate
Else
    iAns = MsgBox("Please enter an 'Apply Again' Date to
continue, or click Cancel to erase this record",
vbOKCancel)
        If iAns = vbOK Then
        Cancel = True
        NextSubmittalDate.SetFocus
    Else
        Cancel = True
        Me.Undo ' erase the entire form
        End If
  End If
End If
End Sub

In this case, Undo isn't undoing.  I've used something
similar in the past but on the main form, not the
subform.  I'm not all that interested in the data being
wiped out, so I'd take suggestions of how to make the
field required based on the other field without getting in
an endless debugging loop.

If you have a suggestion please be VERY explicit.
Thanks, Steph



Sat, 30 Apr 2005 05:59:16 GMT  
 Undo
When you are referring to a subform, you have to "go
through the main form" to get to anything on it.  for
example, consider that you are using...

frmMain, as the main form...ctlSubForm, as the CONTROL on
the main form and "holds" the sub-form...frmSubForm, as
your sub-form

Then, to reference the subform, you need to use, for some
examples...

Forms![frmMain]![ctlSubForm].Form.Undo
Forms![frmMain]![ctlSubForm].Form.RecordSource = ""
Forms![frmMain]![ctlSubForm].Form![ctlCombo] = "Blue"

Get the idea there ?

Rodney M. Gabriel

Quote:
>-----Original Message-----
>Hi. I am trying to make sure that a field is completed
>based on the data in another field.  Both of the fields
>are on a subform.

>Specifically, if combo81 (status type) is "1" (awarded)
>then I want NextSubmittalDate to be required.

>I'm trying:
>Private Sub Form_BeforeUpdate(Cancel As Integer)
>Dim iAns As Integer
>If Combo81 = 1 Then
>    'status is Awarded
>    If Len(Trim$(NextSubmittalDate & vbNullString)) > 0
>Then
>    'there is something in NextSubmittalDate
>Else
>    iAns = MsgBox("Please enter an 'Apply Again' Date to
>continue, or click Cancel to erase this record",
>vbOKCancel)
>        If iAns = vbOK Then
>        Cancel = True
>        NextSubmittalDate.SetFocus
>    Else
>        Cancel = True
>        Me.Undo ' erase the entire form
>        End If
>  End If
>End If
>End Sub

>In this case, Undo isn't undoing.  I've used something
>similar in the past but on the main form, not the
>subform.  I'm not all that interested in the data being
>wiped out, so I'd take suggestions of how to make the
>field required based on the other field without getting
in
>an endless debugging loop.

>If you have a suggestion please be VERY explicit.
>Thanks, Steph
>.



Sun, 01 May 2005 07:55:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Selective Undo from the Undo List

2. Program Undo

3. Undo in On Error event

4. Undo last action

5. help required with Undo butten events

6. Creating a custom Undo solution?

7. Way to undo changes at a table level?

8. Undo function

9. Bound combo box won't let be cancel/undo, continually generating error messages

10. a solution to growing mdb's and how to undo a form with sub-form

11. Undo Record

12. My undo and delete button won't work

 

 
Powered by phpBB® Forum Software