Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Procedure Timing and Logic Question 1

Status
Not open for further replies.

Lunatic

Technical User
May 8, 2006
405
US
This is regarding a sub-form that pretty much operates independently of the main form (other than to tie the PKs together).

My problem is I can't figure out what order to run the event procedures to make the results of an update-query show in the sub form.

***
Beginning - Dropdown combobox with project name

Middle - ???

End - on entering a Comment field I use "me.form.refresh" to refresh the data in the subform.

***

Here's what I have so far:

Code:
Private Sub Project_Name_Change()

    Dim stDocName As String
    stDocName = "UpdateShareData"

Me![Contact Date].Value = Date
DoCmd.SetWarnings False
    DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
DoCmd.Save
Me!Comments.SetFocus
DoCmd.Save
End Sub

Private Sub Comments_Enter()
    Me.Form.Refresh
End Sub

It updates all previously entered records just fine, but it won't update the current record. From my rummaging around I think this has to do with when Access saves data, but I can't figure out where my order of operations goes wrong.

Any help is appricated.

Thank you!

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
What about this ?
...
Me![Contact Date].Value = Date
[!]Me.Dirty = False[/!] [green]' save current record[/green]
DoCmd.SetWarnings False
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That worked!

That doesn't make any sense to me though... because you added something before the update query was run... Why does adding something before the update query convince Access to save the data so it shows on a refresh after the query has been run? It seems 180 degrees from what the logic should be... [hammer]

Thank you!

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top