By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,135 Members | 1,842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,135 IT Pros & Developers. It's quick & easy.

SubForm to Form Tab VBA

P: 52
I have a subform and a form. Both are in their own tabs. I would like to disable the tab with the main form when someone clicks a specific textbox on the subform.
Dec 10 '07 #1
Share this Question
Share on Google+
4 Replies

Expert 2.5K+
P: 3,532
I have a subform and a form. Both are in their own tabs.
You cannot have a form on a tab! A form on a tab is a subform, so you have two subforms on two tabs!

I would like to disable the tab with the main form when someone clicks a specific textbox on the subform.
You need to tell us a little more about what you're trying to do. If the textbox is clicked on, do you want the other tab disabled permanently or temporarily? If temporarily, when do you want the tab re-enabled?

Linq ;0)>
Dec 10 '07 #2

P: 52
I have a table CASES. There are hundreds of records. I want to create a form that has two tabs. On the first tab I want a datasheet that displays all the data in the table and the second tab that displays a form with the same records based on the same table. On form load the second tab is disabled. Once a user double clicks on the case_id field in the data sheet, I want the second tab which contains the form for the same table to be enabled and display the record selected on the datasheet based on the case_id. I just donít know the code when working with subforms. Thanks a million guys.
Dec 10 '07 #3

Expert Mod 15k+
P: 31,660
I don't know the answer to this one, but until Linq gets back you may want to check out Referring to Items on a Sub-Form. It may prove useful.
Dec 12 '07 #4

Expert 100+
P: 254
Sounds like you want to display all the records on one tab and use tab1 to navigate tab2. You could easily do this using a Combobox on your form (vice tabs). The combobox could display 1 or more fields in a droplist. Make sure your "ID" is in the bound column (defaults to column 1). Code would look similar to this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboMyCombo_AfterUpdate()
  2. DoCmd.GoToControl "txtRecordID" 'The control with the ID in it
  3. DoCmd.FindRecord Me.cboMyCombo, , False, , False, , True
  4. End Sub
You can use pretty much the same code for what you are trying to do.
But gets a little tougher. In a module declare your variable: Public varID as Variant. That way its not form specific.
Expand|Select|Wrap|Line Numbers
  1. Private SubMySubForm_DblClick(Cancel As Integer)
  2. varID = Me.txtID 'Name of control on subform with ID field assigned to it   
  3. DoCmd.GoToControl "txtRecordID" 'The control with the ID in it - the single records
  4. DoCmd.FindRecord varID, , False, , False, , True
  5. End Sub
I have used a list similar to you on a project - when user double-clicked on a record it opened the selected record in its own form as a dialog box. When user finished edit and closed dialog they could navigate to next record or quit app.
Dec 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.