Problem 2450 addressing an external form

I am developing a small vbs ms/access application and I need to setup field in external forms.
On a specific form I am having the 2450 error - unable to find form.
However the form is ther as well as the fields.
I am sending in the snippets as well as the databas and, below, the related code.

Can anyone help?



rivate Sub MasterTab_Change()

    ' para cair aqui é porque o utilizador então está a escolher uma págimna nova
   
    Dim Found As Boolean, _
        IBool As Boolean, _
        IsSearch As Boolean, _
        AllowEnter As Boolean
       
    Dim srcDate As Date
   
    Dim I As Integer, _
        Mf As Integer, _
        Ipos As Integer, _
        NumDias As Integer, _
        L As Integer, _
        AcaoAtribuicao As Integer, _
        IErro As Integer
   
    Dim srcStrSQL As String, _
        strTxt As String, _
        strTabName As String, _
        strUserID As String, _
        strConteudo As String, _
        strDescricao As String, _
        strNotas As String
       
 
       
    Dim cdiDB As DAO.Database
   
    Set cdiDB = CurrentDb
   
    strTabName = Me.MasterTab.Pages(Me.MasterTab).Name
    strUserID = Nz(Me.F00_UserID, "")
    AllowEnter = True
    IBool = InsertLog(strTabName, "Enter", "NO", "", "", 0, 0, strUserID, "")
    If strUserID = "" Then
        IBool = InsertLog(strTabName, "blocked", "NO", "", "", 0, 0, strUserID, "User Not Identified")
        IErro = MostraErro(3, "Utilizador sem Log In")
        Me.Tab_Home.SetFocus
    Else
   
        Select Case strTabName
   
        Case "Tab_Home"                 '-------------------------------------------------------------------------
   
        Case "Tab_NovoRegistoEntrada"
            If strUserID = "" Then
                AllowEnter = False
            Else
                strConteudo = ""
                strDescricao = ""
                strNotas = ""
' CODE WITH PROBLEM ---------------------------------------
                Forms![F0302_RegistosIn_New].[F0302_CampoConteudo] = strConteudo <----
                Forms![F0302_RegistosIn_New].[F0302_CampoDescricao] = strDescricao
                Forms![F0302_RegistosIn_New].[F0302_CampoNotas] = strNotas
'-------------------------------------------------------
            End If
   
        Case "Tab_RegistoSaida"         '-------------------------------------------------------------------------
            If strUserID = "" Then
                AllowEnter = False
            Else
            End If
   
        Case "Tab_ProcuraCDI"           '-------------------------------------------------------------------------
            If strUserID = "" Then
                AllowEnter = False
            Else
                ' limpar o formulário
                IsSearch = False
                If Nz(Me.F0303_DocID, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_Assento, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_Acronimo, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_Expedidor, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_DestinatarioInterno, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_Referencia, "") <> "" Then
                    IsSearch = True
                End If
                If Nz(Me.F0303_Titulo, "") <> "" Then
                    IsSearch = True
                End If
                If Not IsSearch Then
                    srcStrSQL = "SELECT * FROM T03_FichaDocumento WHERE T03_DocID= 987654321"
                    cdiDB.QueryDefs("Q00_FichaTemporaria").SQL = srcStrSQL
                    Me.F0304_ListaRegistosIn.Form.RecordSource = "Q00_FichaTemporaria"
                    Set Q00_FichasSelecionadasDef = cdiDB.QueryDefs("Q00_FichaTemporaria")
                    Set Q00_FichasSelecionadasSet = Q00_FichasSelecionadasDef.OpenRecordset(dbOpenDynaset)
                    Me.F0304_ListaRegistosIn.Form.Recalc
                    Me.Tab_ProcuraCDI.SetFocus
                End If
            End If
       
               
        Case "Tab_Gestao"                   '-------------------------------------------------------------------------
       
        Case Else                           '-------------------------------------------------------------------------
        End Select
   
    End If
   
End Sub



sn 1
sn 2
sn3
sn 4CDI.07.04.accdb
João serras-pereiraAsked:
Who is Participating?
 
mbizupCommented:
You are trying to refer to a subform on the same form, so you need the following syntax:

                Me.F0302_RegistosIn_New_SF.Form.[F0302_CampoConteudo] = strConteudo
                Me.F0302_RegistosIn_New_SF.Form.[F0302_CampoDescricao] = strDescricao
                Me.F0302_RegistosIn_New_SF.Form.[F0302_CampoNotas] = strNotas

Open in new window

0
 
mbizupCommented:
<<  I need to setup field in external forms. >>

By 'external form', do you mean a different form within the same database, or a form that is in a separate database.

If you are trying to refer to another form in the same database, then your syntax is OK.

<< the form is ther as well as the fields.>>

However, the form needs to be open (not just present) for this syntax to work  (just verifying that the form is indeed open).
0
 
mbizupCommented:
I just noticed that you have a sample attached to your question.

Can you outline the steps we need to follow to see/recreate the issue you are having?

ie:  

Open form xyz
Click button 123
... etc
0
 
João serras-pereiraAuthor Commented:
glup... I really forgot THAT

Sorry

here they are:

Step 1 - start  F00_Arranca

Step 2 - Login
        2.1 Click the Login button
        2.2 Identify (User ID "jlpereira" password "1234"
        2.3 Click button "Go"

Step 3
       3.1 select the tab "Registos Entrada"

the error shows....
0
 
João serras-pereiraAuthor Commented:
Thanks a lot! It is perfect (and also the additional comment that I should have the form open (it will be very ueful in the future...)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.