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

Error changing text box on a form to a combo box 1

Status
Not open for further replies.

hondaman2003

Programmer
Mar 3, 2008
202
US
I have a form that works correctly as it is. I have error handling also. I am trying to enhance the form. I am trying to change an existing text box to a combo box. I make no other changes except to right click the text box and click change to combo box. Now I am getting an error "Microsoft access has encountered a problem and needs to close. We are sorry for the inconvenience." I do not know why the error handling is not catching this. I am running access 2002 that is building access 2000 databases by default.
 
You might be dealing with corruption. Try importing your mdb into a new, empty mdb and then Compact and Repair. See if you still have the same problem. BTW, the error you are seeing is because something unexpected happened and Access can not handle it. It is not very likely then coded error handling would have any chance at all to be executed. Access is in an unstable condition at that point.

RuralGuy (RG for short) aka Allan Bunch MS Access MVP acXP winXP Pro
Please respond to this forum so all may benefit
 
How are ya hondaman2003 . . .

I agree with [blue]RuralGuy[/blue]. However when you convert textbox to combo, access can never be sure what to asign for the [blue]rowsource![/blue] ... The reason it doesn't assign any [blue]rowsource![/blue] in this type of morphing.

Botton line is to delete the textbox and use the [blue]combobox wizard[/blue] for construction.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
RuralGuy thank you for responding. I would like to clarify something, when you say import the entire database into a new one, are you referring to literally copying all the tables, queries, and forms to a new database?

TheAceMan1 thank you for responding. I tried that solution and it happened on a completely new combo box.
 
Here is a faq on corruption:
I sometimes find that the corruption affects only one form and it is enough to rebuild the form. I generally find that is it a bad idea to deign using a database that has not been split, it leads to more corruption than otherwise.
 
I would like to clarify something, when you say import the entire database into a new one, are you referring to literally copying all the tables, queries, and forms to a new database?
1)Create a new clean database
2)From the new database menu select
"File"
>"Get External Data"
> "Import"
3)Import the objects
 
MajP thank you for clarifying. I did just that in a fresh new database and it didn't help the problem.

Remou thank you for the link. I took a look at it and was unable to find anything that would help me.

I should explain how large this form is and what it does. It has just about 6,000 lines of VBA code. It has a set of tabs at the top. Then directly under that set I have mutiple sets directly below it that are all on top of each other. They are all invisible except when you have a given tab selected on the main set then a certain set of tabs become visible. Does that all make sence? I have done this to keep everything on one form rather than having many separate forms.
 
A form is only allowed to have 754 over its entire life. This includes controls that have been deleted, and, I suspect controls that are changed may count twice. It may be worth trying cutting and pasting all the controls into a new form. In addition 6,000 lines is quite a bit of code for one form, would it be possible to move some to a separate module?
 
Are you referring to a limit of 754 object? I found something that states you can add up to 754 objects over the life time of a form. I'm not clear on that. Does that mean I add object A, then object B, then delete object A, it will still remember 2 objects, and so the next object will be number 3 as if object A still exsisted?
 
Over the evolution of the form I have added and removed many objects. Is it possible to reset a form so it doesn't think there are more objects than there actually are?
 
That was my suggestion. Create a new form and cut and paste everything into it. That way the 'dead' objects will be lost. Also, don't forget to decompile.
 
I will try to copy the entire form to a fresh form. This will take some time as I will need to re-attach the VBA code to each object. Unless you have a suggestion for that?
 
It is not so difficult. Cut and paste the objects, then cut and paste the code in one chunk. Do not open the form while you are doing this. Make sure you have "Default to Full Module View" ticked under Tools->Options.
 
I was able to highlight and copy all the objects on the form, then open a new form and paste them. The VBA code copied also. This did not fix the problem. Based on the fact that it is likely that I have 754 objects in the form, I deleted a bunch and that fixed the problem.

This is going to force me to split this form up to continue with expansion. I was able to use subforms to keep the appearance that we are still using a single form.

Thanks to everyone that contributed to this effort!!
 
Don't forget that you can load each subform one after the other into a single subform control using code events, it is often the case than you do not even have to adjust the link child and master fields (aside: if you do this, it is best to refer to a control for the link master field). You can use command buttons or labels to give the effect of tab controls.
 
That is a very interesting idea. That would also futher cut down on the number of objects being delt with. Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top