Solved

I have a problem in vb code

Posted on 2007-11-26
4
734 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

688 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