Access datasheet events not firing (1 Viewer)

toomuchcoffeecoder

New member
Local time
Today, 00:09
Joined
Oct 18, 2016
Messages
4
I have an Access form that has a datasheet subform that is populated using a table using the code below.
Code:
SELECT * INTO temp_filter_tbl FROM (SELECT DISTINCT JobsID, ID, ReferenceDate, Source, Status, NODE, NodeStatus, DocSource, CutOverYear FROM tempTable" & sqlafterwhere & ")"
db.Execute (sql)
Me.CombinationViewDS.SourceObject = "Table.temp_filter_tbl
Me.CombinationViewDS("JobsID").ColumnHidden = True
Me.CombinationViewDS("ID").ColumnHidden = True
Me.CombinationViewDS.Requery
I want to capture the AfterUpdate event so that I apply changes in the temp table to the source tables that the temp_filter_tbl is built from. When I edit a row in the datasheet and click on the little pencil on the right hand side of the datasheet the the corresponding row in the temp_filter_tbl is updated so the update is happening but no events are fired. The AfterUpdate event is not the only event not firing none of the events I try are firing and all of the events are being created in the design view of the data sheet from the properties pane.
Code:
Option Compare Database

Private Sub Form_AfterUpdate()
    Debug.Print "Datasheet After Update"
End Sub
Private Sub Form_BeforeUpdate()
    Debug.Print "Datasheet Before Update"
End Sub

Private Sub Form_Click()
    Debug.Print "Datasheet On Click"
End Sub

Private Sub Form_DataChange(ByVal Reason As Long)
    Debug.Print "Datasheet On Data Change"
End Sub

Private Sub Form_DataSetChange()
    Debug.Print "Datasheet On Data Set Change"
End Sub

Private Sub Form_Dirty(Cancel As Integer)
    Debug.Print "Datasheet On Dirty"
End Sub

Private Sub Form_Load()
    Debug.Print "Datasheet On Load"
End Sub
 

Minty

AWF VIP
Local time
Today, 06:09
Joined
Jul 26, 2013
Messages
10,368
Are these events on the SubForm or the Main form?
 

toomuchcoffeecoder

New member
Local time
Today, 00:09
Joined
Oct 18, 2016
Messages
4
These events are on the subform which is a data sheet and they were created from the property pane not manually.

Also thanks for noticing and asking!
 

Minty

AWF VIP
Local time
Today, 06:09
Joined
Jul 26, 2013
Messages
10,368
Does the form have the Has Module property enabled ? It sounds very strange...
What if you view the form in form mode rather than datasheet?
 

toomuchcoffeecoder

New member
Local time
Today, 00:09
Joined
Oct 18, 2016
Messages
4
Has module = Yes
Is there a way to change from datasheet to continuous form with out having to redo everything?
 

Minty

AWF VIP
Local time
Today, 06:09
Joined
Jul 26, 2013
Messages
10,368
Well if you have the text boxes in the design view you simply need to line them and make them look like a datasheet. I have always done it this way if I needed to control things a little more than a data sheet allows for.
 

toomuchcoffeecoder

New member
Local time
Today, 00:09
Joined
Oct 18, 2016
Messages
4
Thank you for the help Minty I appreciate it. I found the solution to this issue thanks to datAdrenaline on utteraccess.com
Code:
Me.CombinationViewDS.SourceObject = "Table.temp_filter_tbl"
When the Source object is set on a datasheet access creates a form object on the fly. To use the in memory Form object Access creates you have to set the event property of the form to be a function in public scope.
Code:
Me.CombinationViewDS.AfterUpdate = "=SomFunctionCall()"
 

Users who are viewing this thread

Top Bottom