Link to home
Start Free TrialLog in
Avatar of GeneralDigitalITS
GeneralDigitalITS

asked on

#Name? appearing on various forms in Access 2007 Runtime

Greetings,
 I am having an issue with several of my database forms. The database is distributed with Access 2007 run time. When a user attempts to use the form #Name? appears in some of the fields. This does not happen on computers with full version of Access. Thanks for any help.
Avatar of mbizup
mbizup
Flag of Kazakhstan image

What specifically are the Control Sources of the fields that show #Name?

Access runtime is a limited capability version of Access so some things can't be fixed without using the full version of Access.

Also, what version of Access are you developing this database in?  Another possible issue could be references.  From the VBA editor on a 2007 machine:

Tools --> References

Uncheck any that are labeled as MISSING and check the correct version from the list.
Avatar of GeneralDigitalITS
GeneralDigitalITS

ASKER

I am developing in Access 2007.
No Missing References.
The control source is MaterialCode, its passed through OpenArgs.
Works fine in the ADP version.
Works fine even if I make an ADE and install it on the development computer.
As soon as I put it on a computer with run time only it turns to #Name?
Capture.PNG
<Works fine in the ADP version.>
So this is also an Access Data Project?
Can you post the code, showing how you set and pass MaterialCode to your form, and also the code where the OpenArgs are being applied.
Line 19


Public Sub cmdAdd_Click()
'=============================================================
' Purpose : Adds a record
' Author  : James DeMichele, 04-25-2002
' Revised : 1 - R. Greger 08-10-2006 per SCN0019
'=============================================================
On Error GoTo HandleErr
  If UpdateData(Me) = True Then
    If CheckForOpenFormInstance("MaterialSourceAdd") > -1 Then
      MsgBox "Only one material source add form can be open at one time.", vbInformation, "Add Material Source"
      Exit Sub
    End If
    ' 1 -----------------------------------------
    If InStr(1, Nz(Me.RecordSource, ""), "ROHS", vbTextCompare) Then
      MsgBox "This material is ROHS Compliant." & vbNewLine & _
                 "Please verify that the material source being added is ROHS compliant.", vbInformation, "ROHS Compliant Material"
    End If
    ' End 1 --------------------------------------
    OpenAddFormSub "MaterialSourceAdd", Nz(Me.txtMaterialCode, "")
    Me.Requery
    'Call GenerateRecordset(Me, , UNIQUE_TABLE)
  End If
ExitHere:
  Exit Sub
HandleErr:
    Select Case Err.Number
        Case 91 ' --- Data did not exist
          Resume ExitHere
        Case 2501 ' --- Open Form action was cancelled (because user does not have permission).
            Resume ExitHere
        Case Else
            MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical, _
            "Form_MaterialSource.cmdAdd_Click"
    End Select
End Sub

Open in new window

This is the form that receives the open arg

Private Sub Form_Current()
'=============================================================
' Purpose : Set up current record when adding.
' Author  : James DeMichele, 04-25-2002
' Notes   :
'=============================================================
    Dim txtComp As String
    Dim sPref As String
    Dim sPref2 As String
    Dim intRef As Integer
    
    If Not Nz(Me.OpenArgs, "") = "" Then
      If InStr(1, Me.OpenArgs, "!", vbTextCompare) <> 0 Then
        txtComp = Nz(DLookup("Company", "dbo.CompaniesFrmView", _
            "Company = '" & Nz(Me.cboCompany, "") & "'"), "")
        If txtComp = "" And bolList = True Then
            MsgBox "This Manufacturer is not in the database.", vbInformation, _
                "Not in Database"
            cboCompany_NotInList Nz(Me.cboCompany, ""), acDataErrContinue
        End If
      End If
    End If
    
    sPref = Nz(DMax("Preference", "dbo.MaterialSource", "MaterialCode = '" & _
    ReplaceTheThing(Nz(Me.txtMaterialCode, "")) & "'"), "")
    
    sPref2 = Nz(DMin("Preference", "dbo.MaterialSource", "MaterialCode = '" & _
    ReplaceTheThing(Nz(Me.txtMaterialCode, "")) & "'"), "")
    
    intRef = Nz(DLookup("Reference", "dbo.MaterialSource", "MaterialCode = '" & _
        ReplaceTheThing(Nz(Me.txtMaterialCode, "")) & "' and Reference = 1"), 0)
        
    If sPref = "" Then
        Me.cboPreference = "B"
    ElseIf sPref = "B" And sPref2 = "B" Then
        Me.cboPreference = "A"
    ElseIf sPref = "Z" Then
        Me.cboPreference = ""
    Else
      Me.cboPreference = Chr(Asc(sPref) + 1)
    End If
    
    If intRef = 0 Then
        Me.chkReference = 1
    Else
        Me.chkReference.Enabled = False
    End If
    
End Sub

Open in new window

Almost sounds like you've made some back-end table structure changes and did not update the runtime front-end.

Scott C
Its happening on a lot of forms. Many of which have had no changes in years. We converted to 2007 runtime a few months back, but this prob just arose within the last couple of weeks.
Hey I just realized that this is happening wherever the IIF function is used. for exampled the default value for the MaterialCode text box was:
=IIf(InStr(1,Nz([OpenArgs],""),"!")<>0,Left(Nz([OpenArgs],""),(InStr(1,Nz([OpenArgs],""),"!")-1)),[OpenArgs])

If I change it to just [OpenArgs] it works fine.  Any ideas on how I can fix this issue?
Your IIF syntax looks okay.

Test this for one of your controls:

- Remove the control source from the textbox (make the property blank)
- Place this VBA in the Open Event of your form:

Me.YourTextBox = IIf(InStr(1,Nz(Me.OpenArgs,""),"!")<>0,Left(Nz(Me.OpenArgs,""),(InStr(1,Nz(Me.OpenArgs,""),"!")-1)),Me.OpenArgs)

Open in new window

Gives me invalid procedure call or argument error...I'm thinking about eliminating all this junk and just setting it to OpenArgs. still doesn't help with all the other occurrences of this issue though. If there any known issues with the IIF statement and 2007 runtime?
GeneralDigitalITS,

Where do we stand?

perhaps you can post a small sample db illustrating this issue?
ASKER CERTIFIED SOLUTION
Avatar of GeneralDigitalITS
GeneralDigitalITS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Kind of a work around.