H
Hugo Marques via AccessMonster.com
Hi...
I'm trying to requery a subform by clicking a button in the main form. When
the button is clicked an sql statement is generated as a string and saved
into a global variable. After having the global query in the variable I try
to set the focus on the subform which reads the global variable and sets
the query as the recordSource.
The problem is that the focus doesn't seem to move from the button and the
Subform_GotFocus() code never runs. I tryed to do:
Me.Subform.setfocus
Me.subform.requery
and it doesn't work.
I also tryed to create a textbox in the header of the subform and it worked
- the query runs. I did:
Me.subform.setfocus
Me.subform.textbox.setfocus
and in the textbox code:
Private sub textbox_GotFocus()
Me.recordsource = globalvariable
Me.requery
end sub
The problem is that it gives an error in the line
Me.subform.textbox.setfocus saying that it can't move the focus to the the
control TextBox
Any suggestions?
Thanks....
Hugo
I'm trying to requery a subform by clicking a button in the main form. When
the button is clicked an sql statement is generated as a string and saved
into a global variable. After having the global query in the variable I try
to set the focus on the subform which reads the global variable and sets
the query as the recordSource.
The problem is that the focus doesn't seem to move from the button and the
Subform_GotFocus() code never runs. I tryed to do:
Me.Subform.setfocus
Me.subform.requery
and it doesn't work.
I also tryed to create a textbox in the header of the subform and it worked
- the query runs. I did:
Me.subform.setfocus
Me.subform.textbox.setfocus
and in the textbox code:
Private sub textbox_GotFocus()
Me.recordsource = globalvariable
Me.requery
end sub
The problem is that it gives an error in the line
Me.subform.textbox.setfocus saying that it can't move the focus to the the
control TextBox
Any suggestions?
Thanks....
Hugo