Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Run-time question

Status
Not open for further replies.

bigchuck

Programmer
Oct 10, 2002
14
US
Are functions like Now() and Date() not supported in Access Run-time? My code works in regular Access; however, it errors out when executed on Run-time and this is the only reason I can fathom as to why this is happening.
 
You have a missing reference somewhere. This is a common problem. I have some code you can use to check your references at runtime, let me know if you want to use it.

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
That would be great! I figured it was a missing reference as other functions work properly. I appreciate your prompt reply to my inquiry.
 
I usually make a quick form with a listbox in it about 6" wide, and set the form as the startup form. Then set the listbox's properties as below:
[tt]
Row Source Type: Value List
Column Count : 3
Column Heads : No
Column Widths : 0.5;1
[/tt]
In the form's load event, add this line of code:
[tt]
Private Sub Form_Load()
Me.ListBox1.RowSource = GetReferences()
End Sub
[/tt]

That's it. Paste this code into a standard module, then when the database opens, the form will appear with the current state of all your references:

[tt]
Public Function GetReferences() As String
' Purpose: format a delimited string to
' use as a listbox rowsource.

On Error GoTo ErrHandler
Dim strStatus As String
Dim refItem As Reference
Dim strReferences As String
Dim strPath As String
Dim strName As String

For Each refItem In References
If IsError(refItem.Name) Then
strStatus = "BAD"
strName = ""
Else
strStatus = "OK"
strName = refItem.Name
End If

If IsError(refItem.FullPath) Then
strStatus = "BAD"
strPath = ""
Else
strStatus = "OK"
strPath = refItem.FullPath
End If
If refItem.IsBroken Then strStatus = "BAD"
strReferences = strReferences & strStatus & _
";" & strName & ";" & strPath & ";"
Next refItem

GetReferences = strReferences

ExitHere:
Exit Function
ErrHandler:
Debug.Print Err, Err.Description
Resume ExitHere
End Function
[/tt]

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top