Problem 2450 addressing an external form

Posted on 2012-09-03
Last Modified: 2012-09-03
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")
        Select Case strTabName
        Case "Tab_Home"                 '-------------------------------------------------------------------------
        Case "Tab_NovoRegistoEntrada"
            If strUserID = "" Then
                AllowEnter = False
                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
            End If
        Case "Tab_ProcuraCDI"           '-------------------------------------------------------------------------
            If strUserID = "" Then
                AllowEnter = False
                ' 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)
                End If
            End If
        Case "Tab_Gestao"                   '-------------------------------------------------------------------------
        Case Else                           '-------------------------------------------------------------------------
        End Select
    End If
End Sub

sn 1
sn 2
sn 4CDI.07.04.accdb
Question by:jirdeaid
    LVL 61

    Expert Comment

    <<  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).
    LVL 61

    Expert Comment

    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?


    Open form xyz
    Click button 123
    ... etc

    Author Comment

    glup... I really forgot THAT


    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....
    LVL 61

    Accepted Solution

    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


    Author Closing Comment

    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...)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now