Results 1 to 3 of 3
  1. #1
    crombiecrunch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    15

    I never know how many quotes to use!!

    can anyone please assist with this code? I never know how many quotes to use or where to place them. VB is complaining about the lines after the #/bin/bash line




    ok i got it down to just one line i cant figure out
    Code:
    TextFile.WriteLine ("if echo "$temp" | grep -q " & rs("Coin_Name") & "; then")
    grrr still trying though

    Code:
    Private Sub Command113_Click()Dim strpath As String
        strpath = CurrentProject.Path & "\"
        Dim cf As String
        cf = strpath & "usr\local\bin\daemonstart.sh"
        ' Create the new file
        'Write the conf file
        Dim fso, TextFile
        Set fso = CreateObject("Scripting.FileSystemObject")
        Set TextFile = fso.CreateTextFile(cf, True)
        TextFile.WriteLine ("# Generated by OneBTCPlace.com")
    'Traverse through all coins
        Dim rs As DAO.Recordset
        Set rs = CurrentDb.OpenRecordset("SELECT * FROM Table1")
        
        'Check to see if the recordset actually contains rows
        If Not (rs.EOF And rs.BOF) Then
            rs.MoveFirst 'Unnecessary in this case, but still a good habit
            Do Until rs.EOF = True
    
    
    TextFile.WriteLine ("#!/bin/bash")
    TextFile.WriteLine ("temp=$(ps aux | grep & rs("Coin_Name") & | grep -v grep))
    TextFile.WriteLine ("echo $temp")
    
    
    TextFile.WriteLine ("#if [[ "$temp" == * & rs("Coin_Name") & * ]]")
    TextFile.WriteLine ("if echo "$temp" | grep -q " & rs("Coin_Name") & "; then")
    TextFile.WriteLine ("echo " & rs("Coin_Name") &  Already Running!"")
    TextFile.WriteLine ("else")
    TextFile.WriteLine (" & rs("Coin_Name") &  -daemon")
    
    
    TextFile.WriteLine ("fi")
    
    
    'Move to the next record. Don't ever forget to do this.
                rs.MoveNext
            Loop
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Just looking at the one line of code you isolated I would say
    TextFile.WriteLine ("if echo ""$temp"" | grep

    However, you should have issues on other lines too if my example works.

    Maybe the following will help

    Code:
    Dim strDblQuote As String
    strDblQuote = "This is a double quote "" thank you."
    
    Dim strDblInsideQuotes As String
    strDblInsideQuotes = """" & "This is a double quote "" thank you." & """"
    
    Dim strDblQuoteTwice As String
    strDblQuoteTwice = "This is a double quote printed twice """" thank you."
    
    Dim strSglQuote As String
    strSglQuote = "This is a single quote ' thank you."
    
    Dim strSingleInDouble As String
    strSingleInDouble = "This is a single qoute within quatations ""'"" thank you."
    
    Debug.Print "strDblQuote = " & strDblQuote
    Debug.Print "strDblInsideQuotes = " & strDblInsideQuotes
    Debug.Print "strDblQuoteTwice = " & strDblQuoteTwice
    Debug.Print "strSglQuote = " & strSglQuote
    Debug.Print "strSingleInDouble = " & strSingleInDouble

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    FYI: you can use single OR dbl-quotes in Access. (singles are easier to see/count)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replace double quotes
    By Kay in forum Programming
    Replies: 27
    Last Post: 12-10-2012, 10:04 PM
  2. Getting the Quotes right
    By aytee111 in forum Programming
    Replies: 2
    Last Post: 10-11-2012, 08:04 PM
  3. New Database on Customer Quotes
    By rkalapura in forum Access
    Replies: 2
    Last Post: 07-13-2012, 07:15 PM
  4. Database to produce quotes
    By rossp0203 in forum Database Design
    Replies: 2
    Last Post: 05-26-2011, 10:15 AM
  5. Remove Quotes within Data Values
    By kfschaefer in forum Programming
    Replies: 0
    Last Post: 02-26-2009, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums