?
Solved

I have a problem in vb code

Posted on 2007-11-26
4
Medium Priority
?
740 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
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

862 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