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

Form replication

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
0
0
NO
Ok I've been working on a form for some time now and it works perfectly (famous last words!).

I now need to copy my form and replace one piece of code throught. I need to change EVERY reference in my form to TblMod3 to another table, ie TblMod2, and then copy the form again replacing TblMod3 with TblMod1.

Using the 'Find & Replace' function makes the VBA code side very easy, but how do I change [red]ALL[/red] the instances which are contained within the combobox's and listbox's properties?

Solo7 [thumbsup2]
 
Hi
How about stepping though each field in the form?
I am not sure where exactly the information you want to change is, but say it is the control name:
Code:
Dim ctrl As Control
Dim frm As Form
Set frm = Forms!frmForm

For Each ctrl In frm.Controls
If ctrl.Name Like "tblMod3*" Then
    ctrl.Name = "tblMod2" & Mid(ctrl.Name, 8)
End If
Debug.Print ctrl.Name
Next ctrl

You can use something similar to change most properties. The form must be open in designview in order to run the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top