Need help with expression on a query

F

FPSC

I use MSAccess 2002.

I have a table with the following columns:

Part Description Price Form Button (Memo type)

In the Form Button Memo I have the following code:

<form action="https://www.website.com/cgi-bin/webscr" target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value="Description">
<input type="hidden" name="item_number" value="Part">
<input type="hidden" name="amount" value="Price">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url" value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return" value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return" value="http://www.website2l.com/page2.htm">

I use this table to show items on my website.

The Memo column works perfectly, as a button that will direct the user to a form page with the information included in that code. (Part, Description and Price)

But... when I update the price, description and/or part number on any item, I have to update manually the memo code also on each item.

What I want to do is create a query that will retrieve the Part, Description and Price from the table and an expression that will put in another column the code above but will take the Part, Description and Price values from the columns on the table.
That way I update only Part, Description and Price and the code will be generated automatically.

Something like this:

Expr1: <form action="https://www.website.com/cgi-bin/webscr" target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value=" [MyDatabase]![Description] ">
<input type="hidden" name="item_number" value=" [MyDatabase]![Part] ">
<input type="hidden" name="amount" value=" [MyDatabase]![Price] ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url" value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return" value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return" value="http://www.website2l.com/page2.htm">

I tried this same expression but the syntax is not valid.

The message is:

The expression you entered contains invalid syntax.
You may have entered a comma without a preceding value or identifier.

If it is possible to do this, what else should I put in the expression to make it valid?

Any help will be very appreciated.

Thanks.
 
G

Guest

If I'm correct in understanding this post, the only variable parts are Part,
Description and Price?

I don't know the answer to the question as you ask it, but I might propose
an alternative. If you use a form to do the updates, you could place a
command button on the form to update or replace the contents of the Form
Button field.

Suppose you had a subroutine which took three arguments (part, description,
price) for the OnClick event procedure for this button, read the contents of
the memo field into a string variable (or have all of this code as a constant
in the module or as a plain text file, with a placeholder for the three
pieces you want to change), modify the text accordingly (based on the new
values on the form), and run an update query (update ThisTable set [Form
Button] = <the contents of the string variable> where <criteria that identify
just this record or all records that would be effected>).

Hope this helps!
--
Chaim


FPSC said:
I use MSAccess 2002.

I have a table with the following columns:

Part Description Price Form Button (Memo type)

In the Form Button Memo I have the following code:

<form action="https://www.website.com/cgi-bin/webscr" target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value="Description">
<input type="hidden" name="item_number" value="Part">
<input type="hidden" name="amount" value="Price">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url" value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return" value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return" value="http://www.website2l.com/page2.htm">

I use this table to show items on my website.

The Memo column works perfectly, as a button that will direct the user to a form page with the information included in that code. (Part, Description and Price)

But... when I update the price, description and/or part number on any item, I have to update manually the memo code also on each item.

What I want to do is create a query that will retrieve the Part, Description and Price from the table and an expression that will put in another column the code above but will take the Part, Description and Price values from the columns on the table.
That way I update only Part, Description and Price and the code will be generated automatically.

Something like this:

Expr1: <form action="https://www.website.com/cgi-bin/webscr" target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value=" [MyDatabase]![Description] ">
<input type="hidden" name="item_number" value=" [MyDatabase]![Part] ">
<input type="hidden" name="amount" value=" [MyDatabase]![Price] ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url" value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return" value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return" value="http://www.website2l.com/page2.htm">

I tried this same expression but the syntax is not valid.

The message is:

The expression you entered contains invalid syntax.
You may have entered a comma without a preceding value or identifier.

If it is possible to do this, what else should I put in the expression to make it valid?

Any help will be very appreciated.

Thanks
 
F

FPSC

Chaim,

Thank you very much for your reply.

I really appreciate you took time to read and to give me your suggestion,
but I need a query because the form I use is in my webpage not in access.
The code create a form in a webpage and the query is to update the data on
one of the table's columns used to populate the database results on that
webpage.

The table has: Part, Description, Price, and Code columns.

The Code is the one that I wrote on the original question. It is a html
code.

I use this table to populate the database results on a webpage. That
Database result region includes a form (html form)

So, when I update any price, description or part on the access table,
running the query I will get the updated code. And that is why I need a
query.

Thanks again.

Sonia




Chaim said:
If I'm correct in understanding this post, the only variable parts are
Part,
Description and Price?

I don't know the answer to the question as you ask it, but I might propose
an alternative. If you use a form to do the updates, you could place a
command button on the form to update or replace the contents of the Form
Button field.

Suppose you had a subroutine which took three arguments (part,
description,
price) for the OnClick event procedure for this button, read the contents
of
the memo field into a string variable (or have all of this code as a
constant
in the module or as a plain text file, with a placeholder for the three
pieces you want to change), modify the text accordingly (based on the new
values on the form), and run an update query (update ThisTable set [Form
Button] = <the contents of the string variable> where <criteria that
identify
just this record or all records that would be effected>).

Hope this helps!
--
Chaim


FPSC said:
I use MSAccess 2002.

I have a table with the following columns:

Part Description Price Form Button (Memo
type)

In the Form Button Memo I have the following code:

<form action="https://www.website.com/cgi-bin/webscr" target="website"
method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value="Description">
<input type="hidden" name="item_number" value="Part">
<input type="hidden" name="amount" value="Price">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url"
value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return"
value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return"
value="http://www.website2l.com/page2.htm">

I use this table to show items on my website.

The Memo column works perfectly, as a button that will direct the user to
a form page with the information included in that code. (Part,
Description and Price)

But... when I update the price, description and/or part number on any
item, I have to update manually the memo code also on each item.

What I want to do is create a query that will retrieve the Part,
Description and Price from the table and an expression that will put in
another column the code above but will take the Part, Description and
Price values from the columns on the table.
That way I update only Part, Description and Price and the code will be
generated automatically.

Something like this:

Expr1: <form action="https://www.website.com/cgi-bin/webscr"
target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value=" [MyDatabase]![Description]
">
<input type="hidden" name="item_number" value=" [MyDatabase]![Part] ">
<input type="hidden" name="amount" value=" [MyDatabase]![Price] ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url"
value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return"
value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return"
value="http://www.website2l.com/page2.htm">

I tried this same expression but the syntax is not valid.

The message is:

The expression you entered contains invalid syntax.
You may have entered a comma without a preceding value or identifier.

If it is possible to do this, what else should I put in the expression to
make it valid?

Any help will be very appreciated.

Thanks
 
F

FPSC

I was able to build the query I was asking about, with the kind help of
Brendan Reynolds from the access.developers.toolkittode newsgroup.
Here is the SQL for it:

SELECT tblTest.Part, [tblTest]![Description]+" "+[tblTest]![Length]+"
"+[tblTest]![Width] AS CompleteDescription, tblTest.Price,
"<form action=""https://www.website.com/cgi-bin/webscr"" target=""website""
method=""post"">
<input type=""hidden"" name=""bn"" value=""something"">
<input type=""hidden"" name=""cmd"" value=""_cart"">
<input type=""hidden"" name=""add"" value=""1"">
<input type=""hidden"" name=""business"" value=""one e-mail address"" >
<input type=""hidden"" name=""item_number"" value=""" &
[CompleteDescription] & """>
<input type=""hidden"" name=""item_name"" value=""" & [Part] & """>
<input type=""hidden"" name=""amount"" value=""" & CStr([Price])& """>
<input type=""hidden"" name=""currency_code"" value=""USD"">
<input type=""hidden"" name=""no_shipping"" value=""0"">
<input type=""hidden"" name=""undefined_quantity"" value=""0"">
<input type=""hidden"" name=""image_url""
value=""http:///www.website2.com/images/Logo.jpg"">
<input type=""hidden"" name=""return""
value=""http://www.website2.com/page1.htm"">
<input type=""hidden"" name=""cancel_return""
value=""http://www.website2l.com/page2.htm"">
<input type=""image"" src=""http://someimages.com/images/any.gif""
border=""0"" name=""submit"">
</form>" AS Expr1
FROM tblTest;

Thank you again Brendan.

FPSC said:
Chaim,

Thank you very much for your reply.

I really appreciate you took time to read and to give me your suggestion,
but I need a query because the form I use is in my webpage not in access.
The code create a form in a webpage and the query is to update the data on
one of the table's columns used to populate the database results on that
webpage.

The table has: Part, Description, Price, and Code columns.

The Code is the one that I wrote on the original question. It is a html
code.

I use this table to populate the database results on a webpage. That
Database result region includes a form (html form)

So, when I update any price, description or part on the access table,
running the query I will get the updated code. And that is why I need a
query.

Thanks again.

Sonia




Chaim said:
If I'm correct in understanding this post, the only variable parts are
Part,
Description and Price?

I don't know the answer to the question as you ask it, but I might
propose
an alternative. If you use a form to do the updates, you could place a
command button on the form to update or replace the contents of the Form
Button field.

Suppose you had a subroutine which took three arguments (part,
description,
price) for the OnClick event procedure for this button, read the contents
of
the memo field into a string variable (or have all of this code as a
constant
in the module or as a plain text file, with a placeholder for the three
pieces you want to change), modify the text accordingly (based on the new
values on the form), and run an update query (update ThisTable set [Form
Button] = <the contents of the string variable> where <criteria that
identify
just this record or all records that would be effected>).

Hope this helps!
--
Chaim


FPSC said:
I use MSAccess 2002.

I have a table with the following columns:

Part Description Price Form Button
(Memo type)

In the Form Button Memo I have the following code:

<form action="https://www.website.com/cgi-bin/webscr" target="website"
method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value="Description">
<input type="hidden" name="item_number" value="Part">
<input type="hidden" name="amount" value="Price">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url"
value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return"
value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return"
value="http://www.website2l.com/page2.htm">

I use this table to show items on my website.

The Memo column works perfectly, as a button that will direct the user
to a form page with the information included in that code. (Part,
Description and Price)

But... when I update the price, description and/or part number on any
item, I have to update manually the memo code also on each item.

What I want to do is create a query that will retrieve the Part,
Description and Price from the table and an expression that will put in
another column the code above but will take the Part, Description and
Price values from the columns on the table.
That way I update only Part, Description and Price and the code will be
generated automatically.

Something like this:

Expr1: <form action="https://www.website.com/cgi-bin/webscr"
target="website" method="post">
<input type="hidden" name="bn" value="something">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="one e-mail address" >
<input type="hidden" name="item_name" value="
[MyDatabase]![Description] ">
<input type="hidden" name="item_number" value=" [MyDatabase]![Part] ">
<input type="hidden" name="amount" value=" [MyDatabase]![Price] ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="image_url"
value="http:///www.website2.com/images/Logo.jpg">
<input type="hidden" name="return"
value="http://www.website2.com/page1.htm">
<input type="hidden" name="cancel_return"
value="http://www.website2l.com/page2.htm">

I tried this same expression but the syntax is not valid.

The message is:

The expression you entered contains invalid syntax.
You may have entered a comma without a preceding value or identifier.

If it is possible to do this, what else should I put in the expression
to make it valid?

Any help will be very appreciated.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top