Populating a form field in a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field on a form and I want to do an update query in a table using
that value. I used forms![form name].[control name] but it did not work.
Help
 
I used forms![form name].[control name] but it did not work.
How is someone supposed to be able to help you if you do not tell them what
you did with forms![form name].[control name] and just the results were?

Post your SQL statement.
 
I have a field on a form and I want to do an update query in a table using
that value. I used forms![form name].[control name] but it did not work.
Help

Please help us. There is clearly something wrong with your query, but
we cannot see your query to tell you what.

Open the query in SQL view and post the SQL text here...

John W. Vinson[MVP]
 
Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

John Vinson said:
I have a field on a form and I want to do an update query in a table using
that value. I used forms![form name].[control name] but it did not work.
Help

Please help us. There is clearly something wrong with your query, but
we cannot see your query to tell you what.

Open the query in SQL view and post the SQL text here...

John W. Vinson[MVP]
 
Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

KARL DEWEY said:
I used forms![form name].[control name] but it did not work.
How is someone supposed to be able to help you if you do not tell them what
you did with forms![form name].[control name] and just the results were?

Post your SQL statement.

NewHeartMan said:
I have a field on a form and I want to do an update query in a table using
that value. I used forms![form name].[control name] but it did not work.
Help
 
The form is open, the control is populated and it asks for a parameter value
for Forms![frmOutput].[Fee Type].... Sent you the sql. Sorry for the
frustration, my first time on this forum.

Randy

KARL DEWEY said:
I used forms![form name].[control name] but it did not work.
How is someone supposed to be able to help you if you do not tell them what
you did with forms![form name].[control name] and just the results were?

Post your SQL statement.

NewHeartMan said:
I have a field on a form and I want to do an update query in a table using
that value. I used forms![form name].[control name] but it did not work.
Help
 
IF the form is open then you have probably misspelled the control name or
the form name. Does Fee Type have a space in it? It does in your posted
sql. Which you see to have typed into the window, instead of copying

Additionally, I would use a "!" as the separator between frmOutput and [Fee
Type] not a ".".

Update [tblOutput]
SET[tblOutput].[Fee Type]=[forms]![frmOutput]![Fee Type]

NewHeartMan said:
The form is open, the control is populated and it asks for a parameter
value
for Forms![frmOutput].[Fee Type].... Sent you the sql. Sorry for the
frustration, my first time on this forum.

Randy

KARL DEWEY said:
I used forms![form name].[control name] but it did not work.
How is someone supposed to be able to help you if you do not tell them
what
you did with forms![form name].[control name] and just the results
were?

Post your SQL statement.

NewHeartMan said:
I have a field on a form and I want to do an update query in a table
using
that value. I used forms![form name].[control name] but it did not
work.
Help
 
Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

For one thing, you need some syntactical spaces; and the punctuation
is wrong:

Update [tblOutput] SET [tblOutput].[Fee Type]=[forms]![frmOutput]![Fee
Type];

Note that since you don't have any criteria set, this will update
*every record* in tblOutput to the value in the form. This also
assumes that the Form named frmOutput exists, is open, and contains a
control named [Fee Type] - not Fee_Type or txtFeeType or any other
variation. The Control Source of this control is irrelevant, it's the
Name property of the control that is used.

John W. Vinson[MVP]
 
John, thanks... I have another problem

I copied a number field from table to a text field in another table. The
text field is a length of 7. It contains charecters that I want to front
load with zeros. For example (9 ), I want to be (0000009), a (1234 )
I want it be (0001234). Is there a way in a query to accomplish this? If
you need to write code to open the file and read all the records, identifying
the length and adding 0s, then I really need help. I am exporting to a text
file and I don't know how many significant characters I have in any read of
the text field.

John Vinson said:
Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

For one thing, you need some syntactical spaces; and the punctuation
is wrong:

Update [tblOutput] SET [tblOutput].[Fee Type]=[forms]![frmOutput]![Fee
Type];

Note that since you don't have any criteria set, this will update
*every record* in tblOutput to the value in the form. This also
assumes that the Form named frmOutput exists, is open, and contains a
control named [Fee Type] - not Fee_Type or txtFeeType or any other
variation. The Control Source of this control is irrelevant, it's the
Name property of the control that is used.

John W. Vinson[MVP]
 
If the value is already in the text field you can use

Right("0000000" & [TheTable].[TheField],7)

You can use that to update the field contents. Watch out for zeroes and nulls
they will all get returned as "0000000".

If you are importing the data you can import a calculated field as follows
Format([TheTable].[TheField].,"0000000")
John, thanks... I have another problem

I copied a number field from table to a text field in another table. The
text field is a length of 7. It contains charecters that I want to front
load with zeros. For example (9 ), I want to be (0000009), a (1234 )
I want it be (0001234). Is there a way in a query to accomplish this? If
you need to write code to open the file and read all the records, identifying
the length and adding 0s, then I really need help. I am exporting to a text
file and I don't know how many significant characters I have in any read of
the text field.

John Vinson said:
Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

For one thing, you need some syntactical spaces; and the punctuation
is wrong:

Update [tblOutput] SET [tblOutput].[Fee Type]=[forms]![frmOutput]![Fee
Type];

Note that since you don't have any criteria set, this will update
*every record* in tblOutput to the value in the form. This also
assumes that the Form named frmOutput exists, is open, and contains a
control named [Fee Type] - not Fee_Type or txtFeeType or any other
variation. The Control Source of this control is irrelevant, it's the
Name property of the control that is used.

John W. Vinson[MVP]
 
John,
Thank you so much. The command worked fine. I used 100, 123, 1203 and it
returned 0000100, 0000123 and 0001203. It works great. I am unsure about
your warning about 0's and nulls. No matter. I am greatful. You saved me a
heap of time. Thanks,
Randy Shean

John Spencer said:
If the value is already in the text field you can use

Right("0000000" & [TheTable].[TheField],7)

You can use that to update the field contents. Watch out for zeroes and nulls
they will all get returned as "0000000".

If you are importing the data you can import a calculated field as follows
Format([TheTable].[TheField].,"0000000")
John, thanks... I have another problem

I copied a number field from table to a text field in another table. The
text field is a length of 7. It contains charecters that I want to front
load with zeros. For example (9 ), I want to be (0000009), a (1234 )
I want it be (0001234). Is there a way in a query to accomplish this? If
you need to write code to open the file and read all the records, identifying
the length and adding 0s, then I really need help. I am exporting to a text
file and I don't know how many significant characters I have in any read of
the text field.

John Vinson said:
On Thu, 28 Sep 2006 03:55:01 -0700, NewHeartMan

Update[tblOutput]SET[tblOutput].[Fee Type]=[forms]![frmOutput].[Fee Type]

For one thing, you need some syntactical spaces; and the punctuation
is wrong:

Update [tblOutput] SET [tblOutput].[Fee Type]=[forms]![frmOutput]![Fee
Type];

Note that since you don't have any criteria set, this will update
*every record* in tblOutput to the value in the form. This also
assumes that the Form named frmOutput exists, is open, and contains a
control named [Fee Type] - not Fee_Type or txtFeeType or any other
variation. The Control Source of this control is irrelevant, it's the
Name property of the control that is used.

John W. Vinson[MVP]
 
Back
Top