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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refer to Navigation Control Subform Record

Kennelbloke

Technical User
May 22, 2015
32
1
0
6
AU
Have combed the net and have not found an answer to the following.

Basically a books program for a club. Backend tables are based upon the TransactionsID in the Transactions table.

I wish to be able to double click on a record on a continuous form to open a record on a navigation tab subform.
Forms look like to following. Balance form

BooksBalance.png
and the form I wish to edit on is the following "Income Entry" form
BooksIncome.png
Which is on another button "Income Entry".

VBA on the balance page is so

Private Sub EntryName_DblClick(Cancel As Integer)

DoCmd.OpenForm strDocName, , , "TransactionID=" & Me!TransactionID

End Sub

Private Sub Form_Open(Cancel As Integer)

strDocName = "Forms!MainForm!NavigationSubform.Form!frmExpenditureEntry!sfrmTransactions"

End Sub

However its opening the form directly on its own and not through some sort of reference to the main form with the buttons on the side.

So I can't seem to get it do this cleanly (nicely). I think that its something to do with the forms reference. Any ideas please?
 
Solution
YES! got it to work. Not sure how elegant it is but it works for me.

So...
first off I created a public variable called TransID (integer)

On the income field in the Balance form on any field I put this
TransID = Me!TransactionID
Forms!MainForm!NavigationButton9.SetFocus
SendKeys "{Enter}"
This takes me to correct form.
On that form in the On Current Event I put the following

If TransID <> 0 Then
Me.FilterOn = True
Me.Filter = TransID
Me.Requery
End If
TransID = 0
Me!btnEntry.Caption = "Update Entry"

This brings up the tranasaction so it can be edited.
Hi Duane. My understanding of the sourceobject tag is that it is more like parent. Correct me if I'm wrong.

The Club Balance in on one navigation tab subform and the insert (or edit) is on another navigation tab and subform

Example in attached video
 
DoCmd.OpenForm always opens a new form, not a subform on a main form. I’m not familiar with “navigation tab subform”. Is there actually a tab control on your form?
 
Ahhh... it seems you refer to them as tabs (with the tab property) anyway. I will keep playing
 
YES! got it to work. Not sure how elegant it is but it works for me.

So...
first off I created a public variable called TransID (integer)

On the income field in the Balance form on any field I put this
TransID = Me!TransactionID
Forms!MainForm!NavigationButton9.SetFocus
SendKeys "{Enter}"
This takes me to correct form.
On that form in the On Current Event I put the following

If TransID <> 0 Then
Me.FilterOn = True
Me.Filter = TransID
Me.Requery
End If
TransID = 0
Me!btnEntry.Caption = "Update Entry"

This brings up the tranasaction so it can be edited.
 
Solution
Thanks Duane. You got me thinking that I was heading in the wrong direction
 

Part and Inventory Search

Sponsor

Back
Top