Solved

I have a problem in vb code

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now