Subforms and VBA

ALF3911

New member
Local time
Today, 18:43
Joined
May 9, 2001
Messages
7
I am slowly learning VBA code on my own and really like it. Unfortunately, I sometimes get stuck on things that I think are easy. I am trying to access a field from an open subform and copy it to the form that just loaded. I am trying the following:

Private Sub Form_Load()
TechID = Forms![frmFirstPage]![frmPoweredBy].Form!PowerID
End Sub

However, I keep getting a message stating the field frmPoweredBy is not found.

I am probably missing something easy, but if someone can help I would appreciate it.
 
Hi,

Try this

TechID.Value = Forms![frmFirstPage]![frmPoweredBy].Form!PowerID.Value
 
Ok, that gives me the same error. I did not mention before that the subform lies in a tab control on the main form (I did not think it was important). I am beginning to think that might make a difference. Do I need to call the tab control page first? If so, how can I do this?

Thanks
 
No, you shouldn't need to reference the tab control.

Have you tried...

TechID = Forms![frmFirstPage]![frmPoweredBy]![PowerID]

Without the '.Form'.

Also, try it on the onOpen event instead of the OnLoad event.

hth
 
Thanks for the help. I never did get it to work, but I managed to work around it.
 

Users who are viewing this thread

Back
Top Bottom