Solved

Tabbed Form

Posted on 2013-01-22
19
197 Views
Last Modified: 2013-01-23
Experts,

I have a button on a form that opens a form (frm1)
I am now wanting to put this frm1 in a tab on the form (Project Details)

I have a lot of code on frm1.

I cant just simply copy the code from frm1 to the code on Project Details, correct?  When I run the debugger it gives me some errors.  I basically would have to add all the frm1 code on the fields, current event, after update, etc etc from to project details.  This would take a long time.  Maybe there is some trick to doing this.

Any tips?   Thank you
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
  • 4
19 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808042
post a sample codes that raised error.. and state the error message
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38808049
If you insert this form as a subform within your tab page, you should have minimal changes needed.
0
 

Author Comment

by:pdvsa
ID: 38808082
An example of one error is if on the Project Details form aftter hitting Alt F11 then Alt D for the debugger, it highlights
Private Sub Form_Current()
and gives an error of Ambiguous Name detected

It is because there are actually 2 separate Current events now.  I thought it would sort of combine the Current event from Project Details and the Current event that was on frm1.

IrogSinta:  I can not use a subform.  I have other tabs on the form and think using tabs would be best for this design.  thanks.

Maybe there is no simple shortcut.

errorOnDebug_ProjectDetailsform
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 29

Accepted Solution

by:
IrogSinta earned 333 total points
ID: 38808093
I take back what I said.  Let me rephrase... if your references to your form or controls are relative and not absolute, you will have less problems when you try to insert it in another form (whether as a subform or not).  For instance, if you refer to a control as Me.txtName, you would be fine.  But if you refer to it as Forms!MyForm!txtName, you would have problems. As Cap1 mentioned, try posting your errors and we can help you out better.
0
 

Author Comment

by:pdvsa
ID: 38808101
oh I see what you mean with a subform.  Yes, that is correct.  I was fiddling around with it and noticed that I did not have to make any changes when I inserted as a subform.  The appearance looked a little different though because I had a tab on that subform already.  Hard to explain.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 167 total points
ID: 38808103
<It is because there are actually 2 separate Current events now>
delete the Current event for form (frm1).
in the form "Project Details " module


you should copy the codes of form (frm1) inside the the (frm1) modules.
0
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 333 total points
ID: 38808108
Access will not automatically combine any procedures with the same name.  That would make troubleshooting more difficult.  You need to decide what needs to happen and stick them all into one OnCurrent event.
0
 

Author Comment

by:pdvsa
ID: 38808132
Capricorn:  
Sorry but I dont follow.  I only have code behind the form and combining the codes of both the forms.  I only know of Modules as being a sort of Global Code.  

Seems like Access cant combine procedures with the same name (IrogSinta).

I am not sure if you are attempting a workaround of Access limitation of not being able to combine procedures with the same name.  

Thanks...
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808141
a form have its own current event.

the codes you see, when you click on the form in the VBA window is the FORM's module.
0
 

Author Comment

by:pdvsa
ID: 38808156
Yes OK I see.  That is what I thought.  I dont think I can simply paste the codes in the forms module though without having to first check and see what events would be duplicates.  

Maybe I dont follow completely.
0
 

Author Comment

by:pdvsa
ID: 38808163
hitting Alt F11 takes me direclty to that forms module I believe.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808169
<hitting Alt F11 takes me direclty to that forms module I believe. >

only if the form is open in design view and the one in focus
0
 

Author Comment

by:pdvsa
ID: 38808189
OK.  I dont think it will combine as IrogSinta mentioned.  

I am using the subform method on the tab.  I dont get any errors as I did when copying and pasting all fields into the tab on form Project Details.

All of my NotInList  (and some on click events for the buttons) events dont appear initially but I do see it there when I hit the ... (3 dots).  I guess I would have to do this manually for each field's NotInList event?
0
 

Author Comment

by:pdvsa
ID: 38808192
I am just wondering if there might be some kind of AddIn that will keep the forms events in tact adn would not have to manually click the 3 dots and add that way.  I think you know what I mean....
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808209
i am just puzzled, why your codes will be disrupted..

how did add the form (frm1) to the Projects form?



if you drag and drop (frm1) to the a tab control in projects form, the codes will be automatically be in place.
0
 

Author Comment

by:pdvsa
ID: 38808354
I did not initially do this.  I copied and pasted the fields then copied pasted the code threby having duplicate events.  

Not all codes seem to comeover when using the drag drop method you mentioned.  For example the NotInList event & maybe others. Note that the code is there but when i look at the events in the fields property, they dont appear.  I would have to click the 3 dots (...) dont know name of it.. Then that code NotInList would be there.   It is a sort of refresh.  

Is there a shortcut to "refresh" all of the NotInList codes i mentioned That did not stay intact (and others too).  Thanks.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38808396
them. there is something wrong with your forms.

it should just be as simple as, selecting the correct page in the tab control then drag and drop the form (frm1)
0
 

Author Comment

by:pdvsa
ID: 38809395
Ok.  If anyone objects to a split let me know ... Thank you
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38809454
I believed it would be fine if you copy and paste the controls first before pasting the code. I think you did it in reverse.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question