form controls do not work when dragged into tab form

deb

Active Member
Joined
Feb 1, 2003
Messages
400
I have a form with a button that copies data on main form and sub forms and enters this into the tables. I used the instructions from the link below and it works great!!
http://support.microsoft.com/kb/208824

Now the problem...

When I drag the form into a form with a tab it bombs when it tries to find the form. It is asking for a parameter value for ..Forms!f2CustImpactsEdit!CustImpactID. I thik the problem starts at the tag property...Me.Tag = Me![CustImpactID] line of code.

Is there a way to fix this???

Here is my code
Private Sub btnDuplicate_Click()
Dim dbs As DAO.Database, Rst As DAO.Recordset
Dim F As Form

' Return Database variable pointing to current database.
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone

On Error GoTo Err_btnDuplicate_Click

' Tag property to be used later by the append query.
Me.Tag = Me![CustImpactID]

' Add new record to end of Recordset object.
With Rst
.AddNew
!KPIProjID = Me.KPIProjID
!KPIPMID = Me.KPIPMID
!ReportDtID = Me.ReportDtID
!Scope = Me.Scope
!Invoicing = Me.Invoicing
!SWDeliv = Me.SWDeliv
!HWDeliv = Me.HWDeliv
!Payments = Me.Payments
!MoMtgHeld = Me.MoMtgHeld
!Outage = Me.Outage
!OutagePlan = Me.OutagePlan
!ExWorks = Me.ExWorks
.Update ' Save changes.
.Move 0, .LastModified
End With
Me.Bookmark = Rst.Bookmark

' Run the Duplicate Details append query which selects all
' detail records that have the CustImpactID stored in the form's
' Tag property and appends them back to the detail table with
' the CustImpactID of the duplicated main form record.

DoCmd.SetWarnings False
DoCmd.OpenQuery "q2CustImpactsDupe"
DoCmd.SetWarnings True

'Requery the subform to display the newly appended records.
Me![f2CustImpactsEditDetails].Requery

RetValue = MsgBox("Reminder!! Change the Report Date and other data before clicking the Save button.", vbOKOnly)


Exit_btnduplicate_Click:
Exit Sub

Err_btnDuplicate_Click:
MsgBox Error$
Resume Exit_btnduplicate_Click:
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I really suspect this is just a referencing problem although I'm not smart enough to figure it out from what you provided - here's an invaluable resource that you - the information from which you may already know/understand.

http://www.mvps.org/access/forms/frm0031.htm

Each form has it's own name, however, when embedding a form inside another, it can have a unique name that identifies the subform - in the past, I'd confuse myself when I'd use the same name for the subform and the form itself.

I do not often use tabbed controls - however, I'm pretty sure that shouldn't be relevant. I don't think you can reference a subform on a specific tab through the tab - it's not form.tabname.subformobject - referencing is just form.subformobject; and, putting the same subform onto different tabs would be handled by using a different name for each embedded subform object.

I'm rambling a bit - but it's mostly because I am not completely sure of my answer. I think using tab control is irrelevant - and the whole problem is just a matter of where you are (on the form or on the subform) and which form object you're referencing at a particular time.

Mike
 
Upvote 0
Deb,
At the start of your question you have this form referenced:
Forms!f2CustImpactsEdit!CustImpactID
So, is this the form that you have the Tab Control on that you have dragged in sub form to? If so, I suppose the new form is named f2custImpactsEditDetails. So, for the requery to work, I believe you will neet to add .Form between the form name (f2CustImpactsEditDetails) and the .Requery. Right now you are asking for the subform control to be requeried, which does not actually requery the form that is within the subform control.

HTH,
 
Upvote 0
MY BAD

There is only one form that was dragged into the tab form.
Forms!f2CustImpactsEditDetails!CustImpactID

I miss typed the form name.

Thanks for your help. I need it!!
 
Upvote 0
You didn't say if you now have it working or not, so here is the line you will need to have the requery work:
Code:
Forms!f2CustImpactsEdit.Form.Requery
HTH,
 
Upvote 0

Forum statistics

Threads
1,217,360
Messages
6,136,102
Members
449,991
Latest member
IslandofBDA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top