DISABLE ADBLOCK

ADBlock is blocking some content on the site

ADBlock errore

VB6 MS access driver connection string using label or variable

StackOverflow https://stackoverflow.com/questions/20301752
  •   vb6
  •  | 
  •  
  •  | 
  •   ( words)
 Checked

Question

by default MS access connection string is

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
    "dbq=Database1.mdb;" & _
    "DefaultDir=E:\somepath;" & _
    "uid=Admin;Pwd=;"

and i want use label to get database path info

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
    Chr(34) & "dbq=" & lblF.Caption & ";" & Chr(34) & _
    Chr(34) & "DefaultDir=" & LocL.Caption & ";" & Chr(34) & _
    "uid=Admin;Pwd=;"

but it's fail :(

No correct solution

OTHER TIPS

Remove all the Chr() calls. You don't need to insert any double quotes in this connection string.

i.e.

connection = "Driver={Microsoft Access Driver (*.mdb)};" & _
             "dbq=" & lblF.Caption & ";" & _
             "DefaultDir=" & LocL.Caption & ";" & _
             "uid=Admin;Pwd=;"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow