Solved

Visual basic error

Posted on 2007-11-19
5
176 Views
Last Modified: 2013-11-27
What is the error in this code?

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ "C:\Documents and Settings\reid\Desktop\BSN Home.mdb;"

I get an identifier message about the underscore next to the ampersand above - what shouod I change it to?
       
0
Comment
Question by:Dier02
5 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 300 total points
ID: 20311166
try:

Private strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\reid\Desktop\BSN Home.mdb;"
0
 

Assisted Solution

by:Encognito
Encognito earned 20 total points
ID: 20311210
you may be able to change & to + if thats the problem
0
 
LVL 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 150 total points
ID: 20311541
ryancys' correct. The underscore is used when splitting code over multiple lines. If all the code is on the one line, the underscroe is not needed.

Wayne
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 30 total points
ID: 20311542
Private strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\Documents and Settings\reid\Desktop\BSN Home.mdb;"
0
 
LVL 2

Expert Comment

by:andrewneely
ID: 20319331
try using dim instead of private inside subproceedures.  Private can be used at the class, form or module levels, but not at the subroutine level
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now