#Name? in text box where default is Date()

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

#Name? in text box where default is Date()

Post by Pat »

What reference do i need for the Date()?
Last edited by Pat on 07 Nov 2011, 07:21, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Date? in text box where default is Date()

Post by HansV »

Do you mean #Name?
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Date? in text box where default is Date()

Post by Pat »

Yes i do mean #Name?.
Another piece of information here is that the database is an MDE where there is no source MDB.

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Date? in text box where default is Date()

Post by HansV »

Date() is a standard function from the Visual Basic for Applications library. This library is always available. If it is not recognized, thus usually means that another reference is missing. However, there is no way to set or clear references in an .mde database, so I fear you're out of luck.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Date? in text box where default is Date()

Post by Pat »

I thought so, my only hope is to make sure all the dll's and ocx's are present, so i am flying blind in this.

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Date? in text box where default is Date()

Post by HansV »

You can only find out by trial and error... :sad:
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Date? in text box where default is Date()

Post by Pat »

So true, wish me luck as you wave me ......

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Date? in text box where default is Date()

Post by Pat »

I have the following code that partly works:

Code: Select all



Private Sub CommandTest_Click()

    Dim strDB As String
    Dim appAccess As Object
    ' Initialize string to database path.
    Const strConPathToSamples = "C:\Data\TR corp\Accounting2000\"

    strDB = strConPathToSamples & "Accounting2000Interface.mde"
    ' Create new instance of Microsoft Access.
    Set appAccess = CreateObject("Access.Application")
    ' Open database in Microsoft Access window.
    appAccess.OpenCurrentDatabase strDB
    Dim intRef As Integer
    Dim strMsg As String
    
    If appAccess.References.Count = 0 Then
        MsgBox "ZERO references found...", vbInformation, "No References"
    Else
        Debug.Print "No of refs is " & appAccess.References.Count
        strMsg = ""
        For intRef = 1 To appAccess.References.Count
            strMsg = strMsg & appAccess.References(intRef).Name & ": "      <<<<<<<<<<<<<<<<<
            strMsg = strMsg & appAccess.References(intRef).FullPath & vbCrLf
        Next
    End If
    Debug.Print strMsg
    MsgBox "all done" & vbCrLf & strMsg
    
End Sub
It crashes on the pointed to line with "Method 'name' of object 'Reference' failed"

Is there another approach i can adopt here?
You do not have the required permissions to view the files attached to this post.

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Date? in text box where default is Date()

Post by Pat »

Is there any way to translate the Guid, Major and Minor properties into the Filename and path, or even just filename?

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Date? in text box where default is Date()

Post by HansV »

I don't think you can view the references in an .mde/.accde database.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Name? in text box where default is Date()

Post by Pat »

You are right, but what i have got is a database A that can read and display the references in another database that is a MDE database.

My only problem is it won't show me what the MISSING reference filenames are.

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Name? in text box where default is Date()

Post by HansV »

I don't have a .mde database to test. With a .accde, your code returns the names and paths of all references.
If you wish, you can delete all objects from your .mde and attach it (zipped).
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: #Name? in text box where default is Date()

Post by Pat »

Why i am doing this is so the client can move the app to another server.

It seems i have found out why the 'Name' was incorrect.
I ran my code against the mde that works in the online environment. I ran it and captured the online references in a table, i then ran it on the server where the user wants it put and captured those references in another table, then compared the 2 tables.

The problem turned out to be a Unbroken reference that was NOT registered.

Thanks for your advice and interest Hans

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: #Name? in text box where default is Date()

Post by HansV »

Good for you!
Best wishes,
Hans