Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    MF_PA is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2024
    Location
    Italy
    Posts
    21

    In fact. I explained to you that with another MDB (always in Access) this database opens and reads. In this mdb (separate from my db and which acts as software), there are modules, windows, queries, macros and more. I limit myself to adding something useful to my research in this. I can't send you the other mdb because I'm not the author

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Cannot really help then, as unsure as to what is what.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #18
    MF_PA is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2024
    Location
    Italy
    Posts
    21
    Sorry but I use Google translation. Mask for me is not something to hide, it is a form with it's controls. I know that it is really all very complicated, the MDB software that consulted it was born for a much less complicated database. Over the years, tables and/or columns have been added to the database which consists of an annual balance sheet that some companies have to do in special circumstances. In some cases, those who added new tables later assigned names that did not match (for example, in table AA you find DescrRagSoc and in table BB you find Nome_RagSociale, or in table AA a column is called IstatProv and in table IC the column is called IstatProvUL, or again in a column of a table a column that refers to quantity is expressed in numbers and in another the corresponding column is expressed in letters). In short, I have to live with it even if I don't like it at all.

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    I feel for you.
    However we need enough of the Fe to recreate your issue. Ony then can we ( or at least me) have an idea as to what is wrong. That involves walking the code and debugging it.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #20
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,205
    Quote Originally Posted by Welshgasman View Post
    I have no idea as to what you keep addressing as a mask?
    A mask to me is something that hides something?
    In Italian language Office, a form is called a mask.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #21
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Quote Originally Posted by isladogs View Post
    In Italian language Office, a form is called a mask.
    As I mentioned then, the opposite to what I think of as a mask?

    Could not be further from the truth, at least in Italian?

    As a matter of interest, what do they call an actual mask?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    mask >> "maschera"

    Okay, maybe don't need to review frontend
    My final word is to use a form as SourceObject and set its RecordSource property then you will have form events available for code behind subform.

    Assuming radio buttons are members of OptionGroup, consider:
    Code:
    strCelta = Choose(Me.Opt, "AA", "BB", "BE", "DA", "DB", "IA", "IB", "IC", "ID", "IE", "IF", _
                              "RA", "RB", "RC", "RD", "RE", "RF", "VC", "VD", "VE", "VF", "VG", "VH", "VU")
    Me.SM_SlittamentiSospetti.Form.RecordSource = "Query.QSlittamentiSospetti_in" & strCelta
    Me.lblTitolo.Caption = "RICERCA SLITTAMENTI SOSPETTI NELLA TABELLA " & strCelta
    Also, consider alternative instead of hard-coding values with SELECT CASE or Choose(), have a table with the 2-letter values and use DLookup():
    strCelta = DLookup("Celta", "tblCelta", "ID=" & Me.Opt)
    Could use a combobox instead of an OptionGroup (again, a table would be helpful). However, if you expect that this list of 2-letter codes will never (or rarely) change), OptionGroup is probably fine.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,823
    Hi
    The attached screenshot shows some of your tables.

    All of the tables has what is commonly known as "Repeating Groups".
    i.e. Table "BD"
    Has fields D2 & UnitMisD2 through to D15 & UnitMisD15
    Each of these fields should be Records in a related table.

    The same applies to table "BE"
    Has fields R1 & UnitMisr1 through to R13 & UnitMisR13
    Each of these fields should be Records in a related table.
    Attached Thumbnails Attached Thumbnails Tables.png  

  9. #24
    MF_PA is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2024
    Location
    Italy
    Posts
    21
    Quote Originally Posted by June7 View Post
    We need the frontend as well.

    This is the most bizarre relationships setup I have ever seen. 3 and 4 fields for compound keys!!!!

    What purpose does this db serve? Why not some meaningful table names?

    I see that tables are not identical in structure but there is enough commonality that a form could work.

    I also considered this database to be the most bizarre configuration of relationships I had ever seen. This database contains information on waste management in my country and, sometimes, even outside it. Companies must report their information annually. Each declaration automatically includes the ISTATProv code (a code that depends on their city) and a CIuProv code (an automatic, unique numerical code for the declaration). The year is always present in each record to ensure that the correct table is displayed at the front (access software). A few years ago, it was easier to work with about 10 tables, but in about 10 years, it became necessary to manage other new information required by my country, so every 2 or 3 years, some public employees implemented new tables in the way I described.


    The problem is that this is an evolving project managed by people other than those who created the database. The software (in Access MDB format) has also evolved. It was initially created by a civil servant for personal use, then updated over the years by him (or another colleague). I have a copy that I am adapting, even though I am not an expert in Access or VBA, adding what I need for my research.


    However, I would like to inform you that I have solved my problem by using a new form (without a subform), which is divided into two parts in the display. The bottom part displays the search query in spreadsheet format, and the top part displays it in standard format. Here I have added my options/bottom and other information that needs to be displayed (e.g., company name, address, and contact details for requesting corrections to incorrect data).
    Where useful, here is the code I used. (My code works. Some instructions may seem superfluous, but they helped me achieve my goal. Of course, you could also improve and correct it.)

    Thanks to everybody


    Code:
    Option Compare Database
    Sub AggiornaFinestra_m_AA_AB()
    ' istruzione  poi ripetute  in tutti  i controlli (campi delle 4 colonne visualizzate in basso)
    If aperta("m_AA_AB") Then
        Dim rs As Object
    
    
        Set rs = Forms!m_AA_AB.RecordsetClone
        rs.FindFirst "[Anno]='" & Me![Anno] & "' AND [IstatProv]='" & Me![IstatProv] & "' AND [CIUProv] = '" & Me![CIUProv] & "'"
        If rs.NoMatch = False Then
            Forms!m_AA_AB.Bookmark = rs.Bookmark
        Else
            MsgBox "Dichiarazione non trovata"
        End If
        
        Forms!m_AA_AB!esci.SetFocus
    End If
    End Sub
    Sub AggiornaQuestaForm()
    Me!DescrRagSoc = Forms!m_AA_AB!DescrRagSoc
    Me.CF = Forms!m_AA_AB![CF]
    Me.provCCIAA = Forms!m_AA_AB![provCCIAA]
    Me.Testo1 = Forms!m_AA_AB![CIUProv]
    Me.CodIstatAttivitaPrevalente = Forms!m_AA_AB![CodIstatAttivitaPrevalente]
    Me.NumIscrRea = Forms!m_AA_AB![NumIscrRea]
    Me.TotAddettiInUL = Forms!m_AA_AB![TotAddettiInUL]
    Me.MesiAtt = Forms!m_AA_AB![MesiAtt]
    Me.PrefTel = Forms!m_AA_AB![PrefTel]
    Me.Telefono = Forms!m_AA_AB![Telefono]
    Me.Via = Forms!m_AA_AB![Via]
    Me.NumCivico1 = Forms!m_AA_AB![NumCivico1]
    Me.Cap = Forms!m_AA_AB![Cap]
    Me.comune = Forms!m_AA_AB![comune]
    Me.prov = Forms!m_AA_AB![prov]
    Me.IstatProvincia = Forms!m_AA_AB![IstatProvincia]
    Me.IstatComune = Forms!m_AA_AB![IstatComune]
    Me.DataCompilazione = Forms!m_AA_AB![DataCompilazione]
    Me.DataPresentazione = Forms!m_AA_AB![DataPresentazione]
    Me.Testo167 = Forms!m_AA_AB![Testo167]
    Me.Testo187 = Forms!m_AA_AB![Testo187]
    
    
    
    
    End Sub
    
    
    Private Sub Anno_Click()
    'chiama la mia sub
    AggiornaFinestra_m_AA_AB
    AggiornaQuestaForm
    
    
    End Sub
    
    
    Private Sub Cornice4_AfterUpdate()
    'in corrspondenza ai pulsanti d'opzione (parte1)
        Call CaricaSlittamenti(Me.Cornice4.Value)
        'in corrspondenza ai pulsanti d'opzione (parte1).Value)
        'in corrspondenza ai pulsanti d'opzione (parte1)
    
    
    End Sub
    
    
    Private Sub esci_Click()
     DoCmd.Close
    End Sub
    
    
    Private Sub Form_Current()
      Me.DescrErroreAA = "Campo sospetto '" & Me.CampoSospetto.Value & "'  informazione sospetta: '" & Me.ValoreRiscontrato.Value & "'"
         Me.DescrErroreAA.BackColor = vbYellow
         Me.DescrErroreAA.ForeColor = vbRed
        Me.DescrErroreAA.FontBold = True
        
    End Sub
    
    
    Private Sub Form_Load()
    'assegno a txtAnno  il valore  giÃ* presente nel controllo AnnoDati della finestra Panello
    Me.txtAnno = Forms!Pannello![AnnoDati]
      ' Aggiorna il titolo
        Me!lblTitolo.Caption = "RICERCA SLITTAMENTI SOSPETTI NELLA TABELLA " '& strScelta
         ' Aggiorna la textbox/label ---
        Me.VisualizaAdesso.Caption = "Tbl selezionata: " '& strScelta
    End Sub
    
    
    Private Sub grpScelta1_AfterUpdate()
    Call CaricaSlittamenti(Me.Scelta1.Value)
    End Sub
    
    
    Private Sub grpScelta2_AfterUpdate()
    Call CaricaSlittamenti(Me.Scelta2.Value)
    End Sub
    
    
    Private Sub IstatProv_Click()
    'chiama la mia sub
    AggiornaFinestra_m_AA_AB
    AggiornaQuestaForm
    
    
    End Sub
    
    
    Private Sub CIUProv_Click()
    'chiama la mia sub
    AggiornaFinestra_m_AA_AB
    AggiornaQuestaForm
    End Sub
    
    
    Private Sub CampoSospetto_Click()
    'chiama la mia sub
    AggiornaFinestra_m_AA_AB
    AggiornaQuestaForm
    End Sub
    
    
    Private Sub SceltaA1_AfterUpdate() ' SceltaA1 è una cornice con pulsanti d'opzione
     Call CaricaSlittamenti(Me.SceltaA1.Value)
    End Sub
    
    
    Private Sub ValoreRiscontrato_Click()
    'chiama la mia sub
    AggiornaFinestra_m_AA_AB
    AggiornaQuestaForm
    End Sub
    
    
    
    
    Private Sub CaricaSlittamenti(Scelta As Integer)
        
        Dim strScelta As String
        Dim strQuery As String
        
        Select Case Scelta
            Case 1: strScelta = "AA"
            Case 2: strScelta = "BB"
            Case 3: strScelta = "BE"
            Case 4: strScelta = "DA"
            Case 5: strScelta = "DB"
            Case 6: strScelta = "IA"
            Case 7: strScelta = "IB"
            Case 8: strScelta = "IC"
            Case 9: strScelta = "ID"
            Case 10: strScelta = "IE"
            Case 11: strScelta = "IF"
            Case 12: strScelta = "RA"
            Case 13: strScelta = "RB"
            Case 14: strScelta = "RC"
            Case 15: strScelta = "RD"
            Case 16: strScelta = "RE"
            Case 17: strScelta = "RF"
            Case 18: strScelta = "VC"
            Case 19: strScelta = "VD"
            Case 20: strScelta = "VE"
            Case 21: strScelta = "VF"
            Case 22: strScelta = "VG"
            Case 23: strScelta = "VH"
            Case 24: strScelta = "VU"
            Case 31: strScelta = "AA"
            Case 32: strScelta = "BB"
            Case Else
                'Me.RecordSource = ""
                'Me!lblTitolo.Caption = "Seleziona una ricerca"
                Exit Sub
        End Select
        
        On Error GoTo GestErr
        
        strQuery = "QSlittamentiSospetti_in" & strScelta
        
        ' --- DEBUG ---
        Debug.Print "Carico query: " & strQuery
        MsgBox "E'in esecuzione la '" & strQuery & "' che hai appena selezionato. Attendere!", vbInformation
        
        ' --- Imposta origine dati della maschera ---
        Me.RecordSource = strQuery
        Me.Requery
        
        ' Aggiorna il titolo
        Me!lblTitolo.Caption = "RICERCA SLITTAMENTI SOSPETTI NELLA TABELLA " & strScelta
         ' --- Qui aggiorni la textbox/label ---
        Me.VisualizaAdesso.Caption = "Tbl selezionata: " & strScelta
      
        Exit Sub
        
    GestErr:
        MsgBox "Errore " & Err.number & ": " & Err.Description, vbCritical
    End Sub

  10. #25
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Pleas mark the thread Solved then. Thread Tools, top right on green thread toolbar.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #26
    MF_PA is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2024
    Location
    Italy
    Posts
    21
    SOVED for me. Thanks.
    PS: your tread tools show me the "mark as unsolved" opportunity an no other choise such as "mark as solved"

  12. #27
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Any poster in a thread can mark a thread as solved/unsolved. I did it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #28
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,427
    Quote Originally Posted by June7 View Post
    Any poster in a thread can mark a thread as solved/unsolved. I did it.
    I've long wondered about my (apparent) ability to do that with threads that I didn't start. It just seems wrong.
    It should be that only the OP or an admin could do so.
    At least that's my 2 cents. Who am I to say that a thread is solved? If the OP says it's solved then refer back to line 2 above (not including the quote).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #29
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Quote Originally Posted by Micron View Post
    I've long wondered about my (apparent) ability to do that with threads that I didn't start. It just seems wrong.
    It should be that only the OP or an admin could do so.
    At least that's my 2 cents. Who am I to say that a thread is solved? If the OP says it's solved then refer back to line 2 above (not including the quote).
    I have similar views. I could have set it myself, as the O/P did say it was solved, but preferred to ask them to do it. That way they learn.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 09-15-2020, 05:15 AM
  2. Replies: 2
    Last Post: 01-13-2020, 10:17 AM
  3. Replies: 2
    Last Post: 03-14-2019, 11:00 AM
  4. Replies: 2
    Last Post: 01-09-2019, 09:31 AM
  5. User login and only see his records
    By bigguy in forum Forms
    Replies: 3
    Last Post: 04-02-2015, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums