change a value on a form when entering the form

SD23

Registered User.
Local time
Today, 05:53
Joined
Jun 13, 2006
Messages
60
I have two forms. When I enter a textbox on the first form and enter a date and exit the text box (on exit event), it opens up the second form, which already has previously entered data in it. Upon entering this second form, I would like to automatically change one of the fields from a "Yes" to a "No."

Any ideas on how I could achieve this. I would really appreciate some help. Thanks for your time.

here is my code: The line with the asterix is where I try to change the staus from a yes to a no, but that part does not work. BTW there are two forms, not a form and a subform.

Code:
Private Sub Filing_Date_Exit(Cancel As Integer)
If Not IsNull(Filing_Date) Then
Me.Status.Value = "No"
query = "select * from [All Data Inv Discl] where ID in (select IID from IIDD where DID = " & Me.ID & ")"

 On Error Resume Next
                                  
    With CurrentDb
                                
    .QueryDefs.Delete ("UPDID")
    Set qdfNew = .CreateQueryDef("UPDID", query)
    .Close
    End With
    DoCmd.RunSQL query
    DoCmd.OpenForm "Invention Disclosure Input Form", , , , , , "UpdateT"
    [All Data Inv Discl].[Status] = "No" ******
End If

End Sub
 
Change this
Code:
[All Data Inv Discl].[Status] = "No"

to
Code:
Forms![All Data Inv Discl].Status = "No"

And, make sure that [Status] is a control name and not the field name. If it is the field name too, then you should change the control name to something like txtStatus.
 

Users who are viewing this thread

Back
Top Bottom