Subform DS click field, to open tab on another form.

MackMan

Registered User.
Local time
Today, 04:46
Joined
Nov 25, 2014
Messages
174
Hi everyone.

How do I reference a subform DS field to open up a tabbed form on another subform.

Here's what I have.

field one on the Sub DS opens up tab one on another form, as does field two on DS open tab two on another form.

but..

how can I click on "any" field on the DS, run an IF statement, and it checks if that record on the Datasheet, contains information in regards to, IF field one OR field two contains any data, and opens the tabbed form respectively on the other form?

Many thanks as always.
 
You probably have had little response because your request, at least to me, is not easily understood.

You can change the focus to a different tab page using the following in the click event of the field in the sub form.

Forms!frmYourSecondFormName!tabYourTabName.Pages = n
(where n is the page index - first tab page n=0, second n=1 etc.)

how can I click on "any" field on the DS, run an IF statement, and it checks if that record on the Datasheet, contains information in regards to, IF field one OR field two contains any data, and opens the tabbed form respectively on the other form?

This is too cryptic for me.
 
I Cronk.
Thanks for your reply.

What I'm after is trying to simulate split forms. But it can't be a split form for other reasons.

Main form on Top (with tabbed forms), but a datasheet form (Sub form) underneath.
When entering data, Say, for payables, The "Credits" tab is clicked on the main form. and when entering Expenses , the "Debit" tab is clicked on the main form.



Basically, My Datahseet form (Subform) has several fields, and lists all records from ALL tab forms after enter.

What I'm trying to do, is run some code in the datasheet subform (the one that lists all records) and when clicking any field for that record (Record selectors have been removed) it checks if it's a payable, and open up that record in the "Credit" tab of the main form, and if it's a expense record on the Subform Dataheet, open up that record in the main form, under the "Debits" Tab.

Simply, I'm not sure how to reference a datasheet forms records. I can take care of what tab to open, I just need the correct syntax on how to reference a record in datasheet view.

What to search for, on the other hand is the difficult part.

here s how I see it.

On click event on the datasheet.

Dim LngID as long.

if (reference of this record and one field has a value greater than zero ) then
set focus to the relevant form that sits within that relevant tab.
Setfocus to the ID field of said form
docmd.find record LngID
(Then setfocus to any field I want)
ELSE set focus to the other form, and find it's record from the LngID

Something like that.
 
So you have a form with a tab control having two pages and a sub form which is unbound to the parent form.

The subform is bound to a table containing Debit and Credit transactions, with the sub form in datasheet view.

What do you have on the tab pages? What's the difference between the Debit and Credit display? I'd be inclined to just change a caption depending on whether a debit or not. In which case, I'd have the parent form bound to the same transaction table and in the click event set the parent filter to the required record

Code:
me.parent.filter = "TransactionID=" & me.transactionID
me.parent.filteron= true
me.parent.txtCaption =iif([DebitRecord is true], "Debit","Credit")

Incidentally, put the code in a Sub in the subform and just call the Sub on the respective click events - makes it easier to implement any changes.
 

Users who are viewing this thread

Back
Top Bottom