473,372 Members | 818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

javascript in a query's text string

Here is the scenario:

1. I have a table (tblCalendar) with the following fields:
caldID
caldDate
caldTitle
caldInfo
nWinW
nWinH

2. By design, when [caldInfo].value Is Null, [nWinW] and [nWinH] are both
Not Null

3. In order to filter and sort the data (because I want it for an .asp page)
there is a query displaying the first four fields.

4. Problem No1: I want to add a fifth field (column) in the query, that will
display a text string ONLY WHEN the corresponding [caldInfo].value Is Null.

5. Problem No2: That text string is the following javascript command:
<a href="javascript:;" onClick="MM_openBrWindow('filePath','winName',
'status=1,winWidth,winHeight')">Details...</a>

6. Furthermore, the arguments of MM_openBrWindow() should be replaced by the
following text/fieldnames:

filePath = ../calendar/[caldID].htm
winName = htm[caldID]
status=1 = status=1 (the same)
winWidth = [nWinW]
winHeight = [nWinH]

The general idea is that I don't know how to replace/escape the
single/double quotes of the javascript, that should be inside the double
quotes of the text string in the query.

Can you help me please?

------- ---- --- -- - -
[gt] aka geotso
------- ---- --- -- - -
Please, remove hyphens to contact me

Jul 6 '06 #1
5 2381
For Access/Jet SQL: If you are enclosing the string in double-quotes, double
each internal double-quote, and don't change the single quotes, e.g., "The
man said, ""Hello. Would you like a 'near-beer'?"""

Larry Linson
Microsoft Access MVP

"geotso" <ka********@yahoo.grwrote in message
news:e8***********@ulysses.noc.ntua.gr...
Here is the scenario:

1. I have a table (tblCalendar) with the following fields:
caldID
caldDate
caldTitle
caldInfo
nWinW
nWinH

2. By design, when [caldInfo].value Is Null, [nWinW] and [nWinH] are both
Not Null

3. In order to filter and sort the data (because I want it for an .asp
page) there is a query displaying the first four fields.

4. Problem No1: I want to add a fifth field (column) in the query, that
will display a text string ONLY WHEN the corresponding [caldInfo].value Is
Null.

5. Problem No2: That text string is the following javascript command:
<a href="javascript:;" onClick="MM_openBrWindow('filePath','winName',
'status=1,winWidth,winHeight')">Details...</a>

6. Furthermore, the arguments of MM_openBrWindow() should be replaced by
the following text/fieldnames:

filePath = ../calendar/[caldID].htm
winName = htm[caldID]
status=1 = status=1 (the same)
winWidth = [nWinW]
winHeight = [nWinH]

The general idea is that I don't know how to replace/escape the
single/double quotes of the javascript, that should be inside the double
quotes of the text string in the query.

Can you help me please?

------- ---- --- -- - -
[gt] aka geotso
------- ---- --- -- - -
Please, remove hyphens to contact me

Jul 6 '06 #2
Larry,

Thank you very much for your answer, that was the solution to my basic
problem.

Now, can you (or someone else) please explain to me how to limit the
contents of the column shown the text string so, only the cells where the
record's[caldInfo].Value Is Null (Problem No1 in my first post)?

Please note that I've already found a (temporary) solution, using VBScript
in my .asp page, but I would like to know if there is a solution into the
database area.

Thank you again...

then, "Larry Linson" mounted the rostrum and spoke like this:
For Access/Jet SQL: If you are enclosing the string in double-quotes,
double each internal double-quote, and don't change the single quotes,
e.g., "The man said, ""Hello. Would you like a 'near-beer'?"""

Larry Linson
Microsoft Access MVP

"geotso" <ka********@yahoo.grwrote in message
news:e8***********@ulysses.noc.ntua.gr...
>Here is the scenario:

1. I have a table (tblCalendar) with the following fields:
caldID
caldDate
caldTitle
caldInfo
nWinW
nWinH

2. By design, when [caldInfo].value Is Null, [nWinW] and [nWinH] are both
Not Null

3. In order to filter and sort the data (because I want it for an .asp
page) there is a query displaying the first four fields.

4. Problem No1: I want to add a fifth field (column) in the query, that
will display a text string ONLY WHEN the corresponding [caldInfo].value
Is Null.

5. Problem No2: That text string is the following javascript command:
<a href="javascript:;" onClick="MM_openBrWindow('filePath','winName',
'status=1,winWidth,winHeight')">Details...</a>

6. Furthermore, the arguments of MM_openBrWindow() should be replaced by
the following text/fieldnames:

filePath = ../calendar/[caldID].htm
winName = htm[caldID]
status=1 = status=1 (the same)
winWidth = [nWinW]
winHeight = [nWinH]

The general idea is that I don't know how to replace/escape the
single/double quotes of the javascript, that should be inside the double
quotes of the text string in the query.

Can you help me please?

------- ---- --- -- - -
[gt] aka geotso
------- ---- --- -- - -
Please, remove hyphens to contact me
Jul 6 '06 #3
"geotso" <ka********@yahoo.grwrote
Thank you very much for your answer, that
was the solution to my basic problem.
You are welcome. I'm glad I was able to assist.
Now, can you (or someone else) please explain to me how to limit the
contents of the column shown the text string so, only the cells where the
record's[caldInfo].Value Is Null (Problem No1 in my first post)?
In the Query Builder, the CalculatedField would be:

FieldNameYouLike: (IIF IsNull([caldInfo]), "your text string", "")

Best of luck with your application.

Larry Linson
Microsoft Access MVP
Please note that I've already found a (temporary) solution, using VBScript
in my .asp page, but I would like to know if there is a solution into the
database area.

Thank you again...

then, "Larry Linson" mounted the rostrum and spoke like this:
>For Access/Jet SQL: If you are enclosing the string in double-quotes,
double each internal double-quote, and don't change the single quotes,
e.g., "The man said, ""Hello. Would you like a 'near-beer'?"""

Larry Linson
Microsoft Access MVP

"geotso" <ka********@yahoo.grwrote in message
news:e8***********@ulysses.noc.ntua.gr...
>>Here is the scenario:

1. I have a table (tblCalendar) with the following fields:
caldID
caldDate
caldTitle
caldInfo
nWinW
nWinH

2. By design, when [caldInfo].value Is Null, [nWinW] and [nWinH] are
both
Not Null

3. In order to filter and sort the data (because I want it for an .asp
page) there is a query displaying the first four fields.

4. Problem No1: I want to add a fifth field (column) in the query, that
will display a text string ONLY WHEN the corresponding [caldInfo].value
Is Null.

5. Problem No2: That text string is the following javascript command:
<a href="javascript:;" onClick="MM_openBrWindow('filePath','winName',
'status=1,winWidth,winHeight')">Details...</a>

6. Furthermore, the arguments of MM_openBrWindow() should be replaced by
the following text/fieldnames:

filePath = ../calendar/[caldID].htm
winName = htm[caldID]
status=1 = status=1 (the same)
winWidth = [nWinW]
winHeight = [nWinH]

The general idea is that I don't know how to replace/escape the
single/double quotes of the javascript, that should be inside the double
quotes of the text string in the query.

Can you help me please?

------- ---- --- -- - -
[gt] aka geotso
------- ---- --- -- - -
Please, remove hyphens to contact me

Jul 7 '06 #4
I'm afraid that something is wrong, because I get an error when I try to use
the IIf function. According your suggestion the text string became:

strText: (IIf IsNull([caldInfo]), "<a href=""javascript:;""
onClick=""MM_openBrWindow('../calendar/" & [caldID] & ".htm','" &
[newWinName] & "','status=1,scrollbars=1," & [newWinW] & "," & [newWinH] &
"')"">Details...</a>", "")

The error message is: "You must enclose IIf function arguments in
parentheses" and when I close the message, the cursor has been inserted
after the IsNull opening parenthesis.

Do you see something wrong that I don't?

Yet, thanks again for your help

then, "Larry Linson" mounted the rostrum and spoke like this:
"geotso" <ka********@yahoo.grwrote
>Thank you very much for your answer, that
was the solution to my basic problem.

You are welcome. I'm glad I was able to assist.
>Now, can you (or someone else) please explain to me how to limit the
contents of the column shown the text string so, only the cells where the
record's[caldInfo].Value Is Null (Problem No1 in my first post)?

In the Query Builder, the CalculatedField would be:

FieldNameYouLike: (IIF IsNull([caldInfo]), "your text string", "")

Best of luck with your application.

Larry Linson
Microsoft Access MVP
>Please note that I've already found a (temporary) solution, using
VBScript in my .asp page, but I would like to know if there is a
solution into the database area.

Thank you again...

then, "Larry Linson" mounted the rostrum and spoke like this:
>>For Access/Jet SQL: If you are enclosing the string in double-quotes,
double each internal double-quote, and don't change the single quotes,
e.g., "The man said, ""Hello. Would you like a 'near-beer'?"""

Larry Linson
Microsoft Access MVP

"geotso" <ka********@yahoo.grwrote in message
news:e8***********@ulysses.noc.ntua.gr...
Here is the scenario:

1. I have a table (tblCalendar) with the following fields:
caldID
caldDate
caldTitle
caldInfo
nWinW
nWinH

2. By design, when [caldInfo].value Is Null, [nWinW] and [nWinH] are
both
Not Null

3. In order to filter and sort the data (because I want it for an .asp
page) there is a query displaying the first four fields.

4. Problem No1: I want to add a fifth field (column) in the query, that
will display a text string ONLY WHEN the corresponding [caldInfo].value
Is Null.

5. Problem No2: That text string is the following javascript command:
<a href="javascript:;" onClick="MM_openBrWindow('filePath','winName',
'status=1,winWidth,winHeight')">Details...</a>

6. Furthermore, the arguments of MM_openBrWindow() should be replaced
by the following text/fieldnames:

filePath = ../calendar/[caldID].htm
winName = htm[caldID]
status=1 = status=1 (the same)
winWidth = [nWinW]
winHeight = [nWinH]

The general idea is that I don't know how to replace/escape the
single/double quotes of the javascript, that should be inside the
double quotes of the text string in the query.

Can you help me please?

------- ---- --- -- - -
[gt] aka geotso
------- ---- --- -- - -
Please, remove hyphens to contact me

Jul 9 '06 #5

"geotso" <ka********@yahoo.grwrote in message
news:e8***********@ulysses.noc.ntua.gr...
I'm afraid that something is wrong, because I get an error when I try to
use the IIf function. According your suggestion the text string became:

strText: (IIf IsNull([caldInfo]), "<a href=""javascript:;""
onClick=""MM_openBrWindow('../calendar/" & [caldID] & ".htm','" &
[newWinName] & "','status=1,scrollbars=1," & [newWinW] & "," & [newWinH] &
"')"">Details...</a>", "")

The error message is: "You must enclose IIf function arguments in
parentheses" and when I close the message, the cursor has been inserted
after the IsNull opening parenthesis.

Do you see something wrong that I don't?
IIFs with long, complex text strings can be hard to diagnose. Consider
putting that into a function in a standard module, which you can test using
the immediate window, so that you aren't trying to debug a complex
expression by running the query that contains it.

Then you'd use it with something similar to:

strText = MyNewFunction([caldInfo])

Larry Linson
Microsoft Access MVP

Larry


Jul 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.