473,624 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="javascrip t:;" onClick="MM_ope nBrWindow('file Path','winName' ,
'status=1,winWi dth,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 2402
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********@yah oo.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="javascrip t:;" onClick="MM_ope nBrWindow('file Path','winName' ,
'status=1,winWi dth,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********@yah oo.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="javascrip t:;" onClick="MM_ope nBrWindow('file Path','winName' ,
'status=1,winW idth,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********@yah oo.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:

FieldNameYouLik e: (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********@yah oo.grwrote in message
news:e8******* ****@ulysses.no c.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="javascrip t:;" onClick="MM_ope nBrWindow('file Path','winName' ,
'status=1,win Width,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=""javascri pt:;""
onClick=""MM_op enBrWindow('../calendar/" & [caldID] & ".htm','" &
[newWinName] & "','status=1,sc rollbars=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********@yah oo.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:

FieldNameYouLik e: (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********@yah oo.grwrote in message
news:e8****** *****@ulysses.n oc.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="javascrip t:;" onClick="MM_ope nBrWindow('file Path','winName' ,
'status=1,wi nWidth,winHeigh t')">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********@yah oo.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=""javascri pt:;""
onClick=""MM_op enBrWindow('../calendar/" & [caldID] & ".htm','" &
[newWinName] & "','status=1,sc rollbars=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
6425
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 be modified: if(e.CommandName =="Print") { string parsedreceipt = null; parsedreceipt = DecodeReceipt (e.Item.Cells.Text); Session = parsedreceipt;
2
2834
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 to it to view additional details about the selected result (a second database query is triggered). I want this second query to pop up in a new window, the way it would if I used "window.open" in javascript. I've added a function in the
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.