Dynamic field

  • Thread starter Thread starter Igor G.
  • Start date Start date
I

Igor G.

I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
Why do you have a separate form for each product? That doesn't sound
particularly efficient to me...

From the subform, you can determine the name of the parent form as
Me.Parent.Name. To set a default value to a field in the subform, you could
use:

Me.SomeTextbox.Default = Chr$(34) & Me.Parent.txtProduct & Chr$(34)
 
No, I have 20 products, and same number of forms.

Example:
I have forms for products vehicles MAN... etc.
In this form is subform for daily analysis of quality for this vehicles.
I need to subform recognize opened form and display correct data.

„Jeff Boyce“ said:
Igor

I can't quite visualize your design...

"I have forms for each product" implies that when you add a new product, you
have to create a new form. Is this how your application is designed?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
I think you just answered "yes". If you have 20 products, you have 20 forms
....

What happens when you add (or subtract) a product?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
No, I have 20 products, and same number of forms.

Example:
I have forms for products vehicles MAN... etc.
In this form is subform for daily analysis of quality for this vehicles.
I need to subform recognize opened form and display correct data.

„Jeff Boyce“ said:
Igor

I can't quite visualize your design...

"I have forms for each product" implies that when you add a new product, you
have to create a new form. Is this how your application is designed?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
Option for add or subtract product is no needed in this case.
This structure of database is visualy more practical for employees.


„Jeff Boyce“ said:
I think you just answered "yes". If you have 20 products, you have 20 forms
....

What happens when you add (or subtract) a product?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
No, I have 20 products, and same number of forms.

Example:
I have forms for products vehicles MAN... etc.
In this form is subform for daily analysis of quality for this vehicles.
I need to subform recognize opened form and display correct data.

„Jeff Boyce“ said:
Igor

I can't quite visualize your design...

"I have forms for each product" implies that when you add a new product, you
have to create a new form. Is this how your application is designed?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
It's OK.
I put this code in On Current subform property:
Me.txtProduct.DefaultValue = Chr$(34) & Me.Parent.Product & Chr$(34)
Thanks!

„Douglas J. Steele“ said:
Why do you have a separate form for each product? That doesn't sound
particularly efficient to me...

From the subform, you can determine the name of the parent form as
Me.Parent.Name. To set a default value to a field in the subform, you could
use:

Me.SomeTextbox.Default = Chr$(34) & Me.Parent.txtProduct & Chr$(34)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Igor G. said:
I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
Igor

Designing a set of forms to make it easy for users is a good thing.

Designing a set of data and forms to work like a spreadsheet means you will
not get the best use of Access' relationally-oriented features and
functions.

Is there a reason you aren't using a spreadsheet?


--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
Option for add or subtract product is no needed in this case.
This structure of database is visualy more practical for employees.


„Jeff Boyce“ said:
I think you just answered "yes". If you have 20 products, you have 20 forms
....

What happens when you add (or subtract) a product?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Igor G. said:
No, I have 20 products, and same number of forms.

Example:
I have forms for products vehicles MAN... etc.
In this form is subform for daily analysis of quality for this vehicles.
I need to subform recognize opened form and display correct data.

„Jeff Boyce“ wrote:

Igor

I can't quite visualize your design...

"I have forms for each product" implies that when you add a new
product,
you
have to create a new form. Is this how your application is designed?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

I have forms for each product, and each of this form have field txtProduct
(with unique product name). Also, in each of this form is same subform.

I need to use field Product in ACTIVE FORM like default value in subform.
How to detect active form and fileld.

If I use expression [Forms]![ActiveFormName]![txtProduct]
I need to specify ActiveFormName
Thanks!
 
Back
Top