A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Getting an UnBound control value into a Table field??????



 
 
Thread Tools Display Modes
  #1  
Old November 20th, 2009, 04:36 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Getting an UnBound control value into a Table field??????

(see comments in-line below)

"Weebl" wrote in message
...
Jeff,

I tried to figure a way to do that as well. I used a statement like this:

=IIf([StudyType]="Line",[LRate]=[PartsPerHour],IIF([StudyType]="Cutter",[CRate]
=
[PartsPerHour],IIf([StudyType]="Side",[SRate]=[PartsPerHour],IIF([StudyType]="Blister",[BRate]=[PartsPerHour],0))))

This didn't fly either.


Where? Where did you use this? Is this part of a query? If so, please
post the SQL statement of that query. (By the way, you wouldn't use an
IIF() statement like this in a query. Instead, you'd use an IFF() statement
for EACH field, so you could set the value of each/all fields, with separate
IIF() statements). Again, please post the SQL.


I gave a lot of consideration to the Query but couldn't find any
information
on getting the result from the Query to the form.


?Where did you look? There's no special work needed to "get the result from
the query to the form". Simply base your form on your query (rather than
directly on a table).

I am not sure I want to go
straight from the Query to the underlying Table.


If I'm interpreting correctly, good! A query is NOT a user interface, a
form is.

I would like to have all the
data in front of me on the Form so I can confirm all before saving the
information. Besides, I haven't been able to figure out how to go from the
Query to a Table either.


Open a new query in design view.

Add the table.

Add the fields.

Save the query.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.



Thanks.



  #2  
Old November 23rd, 2009, 01:41 PM posted to microsoft.public.access.forms
Weebl
external usenet poster
 
Posts: 11
Default Getting an UnBound control value into a Table field??????

Jeff,

The formulae for calculating the parts per hour is not consistant from part
to part and therefore I couldn't use one query. The form I created will
calculate the rate based on the study information and then I will only need
to store one piece of information instead of two.

What I have is over 600 parts. About half of these only have one rate,
however the other half have two rates for two different processes. This
negates my ability to use one field for the rate and one for the Type of
rate. So I included all four fields in the Table: LRate, CRate, SRate, BRate
= the rate for Line, Cutter, Side, and Blister respectively.

The Form that actualy performs the calculations has a combo box, StudyType,
that is used to specify the Field to recieve the rate data as defined above.
I then have a control for each of the four fields. If I use an IIF() in the
Control Source for the control I can get the data into the proper control,
unfortuantely I can not get the data into the underlying table because I can
not figure out how to bind the control to the field and retain the IIF() that
evaluates the combo box identifying the type of rate.

I tried placing the IIF() under Default Value for the control and that
didn't work. I tried placing it under the various Event sections. Again, no
luck. I tried placing it withit the code for the SaveRecord button without
any success. I am not sure where to go next.

Your patience is greatly appreciated.

"Jeff Boyce" wrote:

(see comments in-line below)

"Weebl" wrote in message
...
Jeff,

I tried to figure a way to do that as well. I used a statement like this:

=IIf([StudyType]="Line",[LRate]=[PartsPerHour],IIF([StudyType]="Cutter",[CRate]
=
[PartsPerHour],IIf([StudyType]="Side",[SRate]=[PartsPerHour],IIF([StudyType]="Blister",[BRate]=[PartsPerHour],0))))

This didn't fly either.


Where? Where did you use this? Is this part of a query? If so, please
post the SQL statement of that query. (By the way, you wouldn't use an
IIF() statement like this in a query. Instead, you'd use an IFF() statement
for EACH field, so you could set the value of each/all fields, with separate
IIF() statements). Again, please post the SQL.


I gave a lot of consideration to the Query but couldn't find any
information
on getting the result from the Query to the form.


?Where did you look? There's no special work needed to "get the result from
the query to the form". Simply base your form on your query (rather than
directly on a table).

I am not sure I want to go
straight from the Query to the underlying Table.


If I'm interpreting correctly, good! A query is NOT a user interface, a
form is.

I would like to have all the
data in front of me on the Form so I can confirm all before saving the
information. Besides, I haven't been able to figure out how to go from the
Query to a Table either.


Open a new query in design view.

Add the table.

Add the fields.

Save the query.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.



Thanks.



.

  #3  
Old November 23rd, 2009, 05:52 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Getting an UnBound control value into a Table field??????

I may not be following your description ... but it sounds like you are
saying you already know the rates per part, per process.

If so, why not store that information in a table and use it (via a query) as
needed?

What am I still not seeing?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Weebl" wrote in message
...
Jeff,

The formulae for calculating the parts per hour is not consistant from
part
to part and therefore I couldn't use one query. The form I created will
calculate the rate based on the study information and then I will only
need
to store one piece of information instead of two.

What I have is over 600 parts. About half of these only have one rate,
however the other half have two rates for two different processes. This
negates my ability to use one field for the rate and one for the Type of
rate. So I included all four fields in the Table: LRate, CRate, SRate,
BRate
= the rate for Line, Cutter, Side, and Blister respectively.

The Form that actualy performs the calculations has a combo box,
StudyType,
that is used to specify the Field to recieve the rate data as defined
above.
I then have a control for each of the four fields. If I use an IIF() in
the
Control Source for the control I can get the data into the proper control,
unfortuantely I can not get the data into the underlying table because I
can
not figure out how to bind the control to the field and retain the IIF()
that
evaluates the combo box identifying the type of rate.

I tried placing the IIF() under Default Value for the control and that
didn't work. I tried placing it under the various Event sections. Again,
no
luck. I tried placing it withit the code for the SaveRecord button without
any success. I am not sure where to go next.

Your patience is greatly appreciated.

"Jeff Boyce" wrote:

(see comments in-line below)

"Weebl" wrote in message
...
Jeff,

I tried to figure a way to do that as well. I used a statement like
this:

=IIf([StudyType]="Line",[LRate]=[PartsPerHour],IIF([StudyType]="Cutter",[CRate]
=
[PartsPerHour],IIf([StudyType]="Side",[SRate]=[PartsPerHour],IIF([StudyType]="Blister",[BRate]=[PartsPerHour],0))))

This didn't fly either.


Where? Where did you use this? Is this part of a query? If so, please
post the SQL statement of that query. (By the way, you wouldn't use an
IIF() statement like this in a query. Instead, you'd use an IFF()
statement
for EACH field, so you could set the value of each/all fields, with
separate
IIF() statements). Again, please post the SQL.


I gave a lot of consideration to the Query but couldn't find any
information
on getting the result from the Query to the form.


?Where did you look? There's no special work needed to "get the result
from
the query to the form". Simply base your form on your query (rather than
directly on a table).

I am not sure I want to go
straight from the Query to the underlying Table.


If I'm interpreting correctly, good! A query is NOT a user interface, a
form is.

I would like to have all the
data in front of me on the Form so I can confirm all before saving the
information. Besides, I haven't been able to figure out how to go from
the
Query to a Table either.


Open a new query in design view.

Add the table.

Add the fields.

Save the query.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.



Thanks.



.



  #4  
Old November 24th, 2009, 06:21 PM posted to microsoft.public.access.forms
Weebl
external usenet poster
 
Posts: 11
Default Getting an UnBound control value into a Table field??????

This is a huge thanks to everyone who tried to help me with this issue. I
used some of what was said by about everyone and combined it in some fasion
or another and was finally able to work it out.

For those who may want to know how to do this in the future, this is what I
did:

1. I created a calculated control to perform the needed calculation.
2. I bound the study type controls to the appropriate fields of the
underlying table.
3. I created an If, Then, Else statement that evaluated the combo box where
my study type was chosen from. It looked like this:

Public Sub StudyType_Change()

'Assign the production rate based on the study type chosen
'and set all other values to "0".
If [StudyType] = "LRate" Then
Me.LRate.Value = Me.PartsPerHour.Value
[CRate] = 0
[SRate] = 0
[BRate] = 0
ElseIf [StudyType] = "CRate" Then
Me.CRate.Value = Me.PartsPerHour.Value
[LRate] = 0
[SRate] = 0
[BRate] = 0
ElseIf [StudyType] = "SRate" Then
Me.SRate.Value = Me.PartsPerHour.Value
[CRate] = 0
[LRate] = 0
[BRate] = 0
ElseIf [StudyType] = "BRate" Then
Me.BRate.Value = Me.PartsPerHour.Value
[CRate] = 0
[SRate] = 0
[LRate] = 0
Else
MsgBox "Enter the rate desired."
[LRate] = 0
[CRate] = 0
[SRate] = 0
[BRate] = 0
End If

'Update the menu with the new values, (Refresh).
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

End Sub

Note: The final Else coresponds to a choice of "Other" on the combo box and
would give a certain amount of flexability to the user. Though at this time I
can not concieve of a practical use for it.

This sub was set through the "On Change" property of the combo box. Notice
the line just before the End Sub. I needed to put this in to auto refresh the
menu so the results would be visible.

I truely hope this helps others and again, my heart felt thanks for the
guidance, and patience from those who responded to my plight.

Weebl

"Weebl" wrote:

I have a form that calculates a production rate in "parts per hour". This
form needs to be able to differentiate between Line work, Cutter work, Side
work, and Blister work.

I created a drop down list for selecting the "Study Type" as listed above. I
then created a text box for each "study type". When I select the "study type"
each text box checks to see if the selection applies to it and makes the
calculation if it does apply. The code for the "Line" study is as follows:

=IIf([StudyType]="Line",2700?/[SecondsPerPart])

I had to put this under Control Source to make it work, but now I can't
figure out how to get the information into the "Line" field of the underlying
table. I attempted to put this code under Default Value, but it had no affect.

I also tried having the "Study Type" drop down box assign the value under
After Update from a seperate calculated control and setting the Control
Source of the "Line" text box to the "Line" field of the underlying table. No
luck.

I'm at my wits end. Please help.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.