Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

set field to blank with sql

Posted on 2004-08-18
11
Medium Priority
?
428 Views
Last Modified: 2012-05-05
I have a simulated drag and drop between list boxes. I need to set one of the fields to blank if draged to one of the boxes. Every thing works but that. I'm trying single quotes within the double quotes. I've tried Null too but nothing seems to work.
Here is the line in question:
SQL = SQL & "TeamCode = ''"
I want teamcode to be "" (Blank)
Any suggestions?



SQL = "UPDATE tbl_PlayerInfo SET "
      Select Case DropCtrl.Name
      Case "TeamPlayers"
    SQL = SQL & "TeamCode =" & "'" & Forms!frm_Teamcode!Tcodecmbo & "'"
      Case "ReqPlayers"
    SQL = SQL & "TeamCode = '', ReqTeam = " & "'" & Forms!frm_Teamcode!Tcodecmbo & "'"
      Case "NPlayers"
    SQL = SQL & "TeamCode = ''"
      Case "VPlayers"
    SQL = SQL & "TeamCode =" & "'" & Forms!frm_Teamcode!Vteam & "'"
   End Select
   
   If (Shift And CTRL_MASK) = 0 Then
   SQL = SQL & " WHERE [tbl_PlayerInfo.ID]=" & DragCtrl
   End If

   DB.Execute SQL

thanks
Ray
0
Comment
Question by:rembocanoe
9 Comments
 
LVL 20

Expert Comment

by:dsacker
ID: 11838058
Try this:

SQL = SQL & "TeamCode = """""
0
 
LVL 20

Expert Comment

by:dsacker
ID: 11838063
The trick is that two doublequotes equals one displayed doublequote, hence the five doublequotes will actually be two displaying one, two more displaying one, then the final doublequote ending the string definition.
0
 

Author Comment

by:rembocanoe
ID: 11838128
didn't work..
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 20

Expert Comment

by:dsacker
ID: 11838156
Can you display the value of SQL and verify that your SQL statement shows that TeamCode = ""?

Also, it may be that you need to add a space between whatever SQL had in it and the forthcoming case logic that appends to it, else you may have the last word of the previous part of that SQL string and the first word of the appended string in your case logic WITHOUT a space in between them. You can verify that by displaying the value of SQL as you go along.
0
 

Author Comment

by:rembocanoe
ID: 11838180
I used a msgbox to check my variable and it is TeamCode = "".

What I ended up doing is setting it to TeamCode = " " then changed my list query to find " " as well as Null and "". This fixed my problem but didn't teach me anything. LOL

Thanks
Ray
0
 
LVL 20

Expert Comment

by:dsacker
ID: 11838234
Seems you should have been able to assign SQL = SQL & "TeamCode = Null" to begin with, but your original posting sounded like you had tried that. Technically, that's the cleanest way.
0
 
LVL 1

Expert Comment

by:Parag_Gujarathi
ID: 11838572
Use SQL & "TeamCode = ' '" i.e. put a blank space between the single quotes. No space between single quotes is treated as NULL!

cheers
Parag.
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 2000 total points
ID: 11841987
Try this


SQL = SQL & "TeamCode = null "


Melih SARICA
0
 
LVL 2

Expert Comment

by:Shahankit
ID: 11846339
Try This

set escape \
SQL = SQL & "TeamCode= \"Null" "

OR
SQL = SQL & "TeamCode =" & Null

good Luck
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question