Solved

Tabbed Form

Posted on 2013-01-22
19
191 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
  • 9
  • 6
  • 4
19 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
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
 
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 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now