alkorya
alkorya

Reputation: 23

MS Access "#Name?" in unbound field on SOME machines

I have a datasheet form bound to table. I added 2 unbound fields and set their Control Source properties to user defined VBA functions: 1. ConcatRelated (http://allenbrowne.com/func-concat.html) 2. Custom function that returns a string:

Public Function GetLowestSatatus(LookupField As String, JSAID As Integer) As String
    On Error Resume Next
    GetLowestSatatus = DLookup(LookupField, "JsaStatuses", "ID=" & DMin("StatusID", "Tasks", "JSAID =" & JSAID))
End Function

It works fine on my and some other machines but there are machines I got "#Name?" in these 2 unbound fields. All machines configured identically.

Any ideas? Thank you!

Upvotes: 0

Views: 154

Answers (1)

HK1
HK1

Reputation: 12220

This problem occurs when proper data is not contained in the LookupField or JSAID origin fields. To avoid this problem I use variants as arguments for user defined functions that will be called from a control's controlsource.

Public Function GetLowestSatatus(LookupField, JSAID) As String
    On Error Resume Next
    GetLowestSatatus = DLookup(LookupField, "JsaStatuses", "ID=" & DMin("StatusID", "Tasks", "JSAID =" & JSAID))
End Function

Upvotes: 1

Related Questions