?
Solved

I have a problem in vb code

Posted on 2007-11-26
4
Medium Priority
?
737 Views
Last Modified: 2013-11-25
I have a problem in this line
error ( Compile error: Can't find project or library)
strFile = Input(LOF(1), #1)



Private Sub Form_Load()
   'Use icon of MDI form
   Me.Icon = mdiMain.Icon

    On Error GoTo sonali
    Dim strFile As String
    Dim arrFile
    Dim strDatabase As String
    Dim arrDatabase
   
   If Dir(App.Path + "\serverpath.txt") <> "" Then
   Open App.Path + "\serverpath.txt" For Input As #1
       strFile = Input(LOF(1), #1)
       arrFile = Split(strFile, ",")
       ServerPath = arrFile(0)
       MailIPAddress = arrFile(1)
       MailPort = arrFile(2)
       SQLServer = arrFile(3)
       SQLUID = arrFile(4)
       SQLPWD = arrFile(5)
   Close #1
   Else
       ServerPath = App.Path + "\"
       MailIPAddress = "192.168.0.100"
       MailPort = "25"
       SQLServer = "p4server"
       SQLUID = "rajesh"
       SQLPWD = "test"
   End If
   
    Open ServerPath & "\Databases.txt" For Input As #2
        strDatabase = Input(LOF(2), #2)
        arrDatabase = Split(strDatabase, vbCrLf)
        For i = 0 To UBound(arrDatabase)
            If Trim(arrDatabase(i)) <> "" Then
                lstDatabases.AddItem Trim(arrDatabase(i))
            End If
        Next i
    Close #2
    lstDatabases.Selected(lstDatabases.ListCount - 1) = True
   
   Exit Sub
sonali:
    If Err.Number = 53 Then  '* file not found
        urmila = MsgBox(" Please place Serverpath.txt In folder " & App.Path, vbInformation)
        Unload Me
        End
        Exit Sub
    End If
   
    If Err.Number = 52 Then  '* file not found
        urmila = MsgBox(" Please check your network connection and " & vbCrLf & "make sure that the database server is running.", vbInformation)
        Unload Me
        End
        Exit Sub
    End If
   
    MsgBox Err.Number & vbCrLf & Err.Description, vbOKOnly + vbCritical
   
End Sub
0
Comment
Question by:sitg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:sitg
ID: 20349152
Pls help me
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 20349203
You probably have a missing library in your project's references.

From the Project menu, choose References...
If one of the ticked libraries has the word 'Missing', remove the tick if it is not being used. If it is definitely needed, you will have to find the file on your computer.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 20349335
replace this line

strFile = Input(LOF(1), #1)

with

strFile = Space$(LOF(1))
Get #1, , strFile
0
 
LVL 17

Accepted Solution

by:
Shanmuga Sundaram earned 1500 total points
ID: 20359914
EDDYKT,

strFile = Input(LOF(1), #1)

seems to be working. I think GrahamSkan is correct. Also Please note sitg, dont disclose your usernames and passwords in public. if any of your employees comes to know about this they can view your database.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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