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

Refer to control on Tab control

Status
Not open for further replies.

FoxProProgrammer

Programmer
Apr 26, 2002
967
US
I am trying to refer to the value of a control on a specific Tab control on a Form.

The names of the objects are:

Form - frm_AddJob
Tab Control - tab_Repair
Control on Tab - txt_job

I tried various things that begin with Forms!frm_AddJob!...
but can't seem to get it to work.

Thanks for your help.

dz
 
Forms!frm_AddJob!txt_Job is the correct syntax.

Max Hugen
Australia
 
It should be possible to refer the the control by name, unless it is on a subform.

[tt]Me.txtJob=123[/tt]

Access requires different names for controls from page to page of a tab control.

You may wish to look at this if you wish to refer to a subform.
 
Well, I figured that was the case... and in fact, the syntax that I initially used was:

to refer to a control on page 0 of the tab:

Forms!frm_AddJob!txt_job.Value

and to refer to a control on page 1 of the tab

Forms!frm_AddJob!txt_job_SRU.Value

As Max noted, the above should have worked and as Remou noted, Access requires different names on each page.

The correct value is returned for the control on page 0, but Null is returned for the control on page 1. I made sure that the spelling of the control is correct, and the control does have a value when the statement is executed. That's what prompted me to try different syntax as I thought the problem might have been that I had to explicitly identify the tab page. Any ideas what is wrong?

Thanks!

dz
 
Try enumerating the controls on the form to see what's wrong, eg
Code:
For i = 0 to Me.Controls.Count - 1
    Debug.print Me.Controls(i).Name, Me.Controls(i).ControlSource
Next i
This may help to spot the problem... maybe a conflict between Field and Control names?

Max Hugen
Australia
 
I found the problem and am working on the solution - I was wrong - the control that contained a Null value was null. I was confused about which tab page the data was on. Sorry for the bother...

dz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top