Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39
  1. #16
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    Thanks all for your patience, a smal sample is on https://we.tl/t-8xlnjlwnLg

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    Please just compact that DB, and zip it and upload here.

    I do not want to agree to a bunch of T&C of a site I will likely never use again.

    No even sure I can get the file unless I register either.? Something else I do not wish to do.?
    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
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    Trying to attach it here DB 2021 Small sample.zip

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    So what is the form that is meant to run when you select from the combo?
    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
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    OK,
    I managed to track down what is meant to be used despite the language difficulty.
    I used the Builder option to enter the criteria and mine came up as '[Forms]![MSKXSelezione]![CASCOMBXSelezione]' without the quotes ?

    I have not used a foreign language access versions, but that criteria works (AS LONG AS THAT FORM WITH THE COMBO IS OPEN!)

    HTH
    Attached Thumbnails Attached Thumbnails combo.PNG   comboselect.PNG  
    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

  6. #21
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    You might also want to set the copyright caption to
    '© 1999 - ' & Year(Date())

    so you do not need to change it every year?
    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
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    Hi Welshgasman, yes it works thank you, really.

    But opening the form, selecting the event and then clicking on the button, is somehow complicate.

    what I would need is, from the Switchboard Panel, to click of the button to search the orders and not seeing this:

    Click image for larger version. 

Name:	Orders.png 
Views:	22 
Size:	16.1 KB 
ID:	44818

    but this (image drawn by me, not real)

    Click image for larger version. 

Name:	Ideal Orders.png 
Views:	20 
Size:	29.6 KB 
ID:	44819

    So having the form to pop up with the selection of events just after clicking on the button.
    otherwiese, in 95% of the cases it will be quicker to remember the event code rather than having to search it on a form that will have to be opened on purpose.

    If it is not possible, no problem we shall give up

    Thansk anyway for your time. And yes the complete copyright says also 2021...

  8. #23
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    I am not sure of your logic.?
    If I wanted to use your process, then I would have a button on that form with the combo, that opened the ordini form.?

    OR I would have combos on the Ordini form that allowed me to filter for relevant data.?

    Not knowing your business, hard for me to say, but if I was doing it from what I know now, I would use the second option?

    OR again put the combo on that switchboard form as you have drawn?, but I do not know if other combos would be involved, so still the second option for me, so each form is filtered for whatever data is required.
    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

  9. #24
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    I'd need to have a combo opening upon clicking the red button (Gestione Ordini), as in the image I have drawn.

    So, without having to open the form first, select the event, going back to the Switchboard and then click on the red button to open the form with the results.

    It should be:
    1) I click on the red button (Gestione Ordini) on the switchboard
    2) The combo box for the event selection pops out.
    3) I select the event (maybe i have to add an OK button?)
    4) The form with the results opens

    I hope it is clear, thanks

  10. #25
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    So change the switchboard to open the Selection form and not the ordini form.?
    Then an event, (double click perhaps) opens the ordini form.?

    However if the other buttons need to do the same thing, then you would need to tell the selection form, which form to open after a combo record had been selected.?

    However as you are using the switchboard, that involves, either changing the code behind it and/or adding extra fields to switchboard table?
    I've done that in the past for security levels for forms, but it is not an easy task TBH.

    Perhaps open the selection form as a popup in the Form Open of ordini, set the value to a TempVar, and close the popup form. The form will then use the TempVar as it's criteria.

    I've not used a form in that way, so do not know when it looks at it's data source, also you can set that up anyway with VBA.
    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
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    I would say that the option:

    So change the switchboard to open the Selection form and not the ordini form.?
    Then an event, (double click perhaps) opens the ordini form.?

    is the easiest one, I think. No idea if a double click or a OK button to confirm, whatever is easier---

  12. #27
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    Well I tested with a tempvar and the selection as a popup, however it appears the source is registered as soon as the form is opened, so it was always one value behind.

    The trouble with your method now, is that the forms are all 'tied' to each other.? You would not be able to open ordini, unless you use selection.?

    So I am guessing all your switchboard options would need selection forms first.?

    In that case I would go with the combos on each form header and set filters?

    I think you need Vlad to advise more than me, as he has way way more experience and would know of other ways.? Sorry.
    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

  13. #28
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Hi Giorgio,
    You can change the code on the switchboard to open the Selection form as a dialog -WidowMode (Docmd.OpenForm.......acDialog), and add a button on it to open the Ordini form for the selected event.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  14. #29
    Giorgio is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2021
    Posts
    36
    YESSS! it worked, I changed the Switchboard to open the selection form where I had added a button to open the orders from. THANK YOU! it is now exactly as we needed it.

    I thought to do the same with the Contacts form (the form which opens not the orders, but the contacts we have for each event) but I faced another problem.
    The contact form has, upon opening after having chosen the event, a check if there are contacts for the selected event, and the a second option, whether we want to include the VOID contacts or not (the ones who told us they are not attending the event).
    This is because if a company does not order, its order simply does not exist, while for the contacts, even if at the end they do not particpate, the contacts exists.

    The opening of the from is under VBA, as follows:

    Code:
    Private Sub Form_Open(Cancel As Integer)Const cstrORDER = "ORDER BY TBLClienti.NomeAzienda, TBLClienti.CodiceCliente"
        
        Dim strFiera As String
        Dim strSQL As String
        Dim strWHERE As String
        
        strSQL = "SELECT TBLContatti.SiglaFiera, TBLClienti.NomeAzienda, TBLClienti.CodiceCliente, " & _
                 "       TBLClienti.Localitą, TBLClienti.Provincia, TBLClienti.Regione, TBLClienti.Nazione, TBLClienti.PrivacyInviata, TBLClienti.DataInvioPrivacy, TBLClienti.Telefono1, " & _
                 "       TBLClienti.Telefono2, TBLClienti.Telefono3, TBLClienti.Fax1, TBLClienti.Fax2, " & _
                 "       TBLClienti.[Email1], TBLClienti.[Email2], TBLClienti.SitoWEB1, TBLClienti.SitoWEB2, " & _
                 "       TBLClienti.FormaGiuridica, TBLClienti.DataAggiornamento, TBLClienti.[AuguriNatale], " & _
                 "       TBLClienti.[ClienteParalleli], TBLClienti.Sospeso " & _
                 "FROM TBLClienti " & _
                 "INNER JOIN TBLContatti ON TBLClienti.CodiceCliente = TBLContatti.CodiceCliente "
                 
    
    
        strFiera = InputBox("FIERA", "INSERISCI LA FIERA")
        If DCount("IDContatto", "TBLContatti", "SiglaFiera = '" & strFiera & "'") = 0 Then
            MsgBox "NON ESISTONO CONTATTI PER QUESTA FIERA", vbOKOnly + vbInformation, "MI DISPIACE"
            Cancel = True
            Exit Sub
        End If
        strWHERE = "WHERE (TBLContatti.SiglaFiera = '" & strFiera & "')"
        
        If MsgBox("Vuoi visualizzare anche i VOID?", vbYesNo + vbCritical + vbDefaultButton2, "SCEGLI SI o NO") = vbYes Then
            ' in questo caso devi visualizzare tutti i contatti
            strSQL = strSQL & " " & strWHERE & ""
        Else
            ' in questo caso devi visualizzare solo i contatti che non sono VOID
            strSQL = strSQL & " " & strWHERE & " AND (TBLContatti.VOID = False) "
        End If
        
        strSQL = strSQL & " " & cstrORDER
        
        Me.RecordSource = strSQL
    End Sub
    So far, the instruction
    Code:
    strFiera = InputBox("FIERA", "INSERISCI LA FIERA")
    opens a small input box where we have to input the event code (having to remeber it). The Italian text says "INSERT THE EVENT"

    I created a different form for event selection called MSKXSelezioneFieraOrdini, identical to the other selection form, but having the button opening the contacts form (MSKContattiFiera) and not the orders one.

    and I changed the code to:

    Code:
    Private Sub Form_Open(Cancel As Integer)Const cstrORDER = "ORDER BY TBLClienti.NomeAzienda, TBLClienti.CodiceCliente"
        
        Dim strFiera As String
        Dim strSQL As String
        Dim strWHERE As String
        
        strSQL = "SELECT TBLContatti.SiglaFiera, TBLClienti.NomeAzienda, TBLClienti.CodiceCliente, " & _
                 "       TBLClienti.Localitą, TBLClienti.Provincia, TBLClienti.Regione, TBLClienti.Nazione, TBLClienti.PrivacyInviata, TBLClienti.DataInvioPrivacy, TBLClienti.Telefono1, " & _
                 "       TBLClienti.Telefono2, TBLClienti.Telefono3, TBLClienti.Fax1, TBLClienti.Fax2, " & _
                 "       TBLClienti.[Email1], TBLClienti.[Email2], TBLClienti.SitoWEB1, TBLClienti.SitoWEB2, " & _
                 "       TBLClienti.FormaGiuridica, TBLClienti.DataAggiornamento, TBLClienti.[AuguriNatale], " & _
                 "       TBLClienti.[ClienteParalleli], TBLClienti.Sospeso " & _
                 "FROM TBLClienti " & _
                 "INNER JOIN TBLContatti ON TBLClienti.CodiceCliente = TBLContatti.CodiceCliente "
                 
    
    
        strFiera = "MSKXSelezioneFieraOrdini.CASCOMBXSelezione"
        If DCount("IDContatto", "TBLContatti", "SiglaFiera = '" & strFiera & "'") = 0 Then
            MsgBox "NON ESISTONO CONTATTI PER QUESTA FIERA", vbOKOnly + vbInformation, "MI DISPIACE"
            Cancel = True
            Exit Sub
        End If
        strWHERE = "WHERE (TBLContatti.SiglaFiera = '" & strFiera & "')"
        
        If MsgBox("Vuoi visualizzare anche i VOID?", vbYesNo + vbCritical + vbDefaultButton2, "SCEGLI SI o NO") = vbYes Then
            ' in questo caso devi visualizzare tutti i contatti
            strSQL = strSQL & " " & strWHERE & ""
        Else
            ' in questo caso devi visualizzare solo i contatti che non sono VOID
            strSQL = strSQL & " " & strWHERE & " AND (TBLContatti.VOID = False) "
        End If
        
        strSQL = strSQL & " " & cstrORDER
        
        Me.RecordSource = strSQL
    End Sub
    Imagining that the instruction
    Code:
     strFiera = "MSKXSelezioneFieraOrdini.CASCOMBXSelezione"
    , replacing the one calling for the InputBox, would have opened the orders form.

    But the only thing I get is the message "There are no contacts for this event" (in Italian: NON ESISTONO CONTATTI PER QUESTA FIERA") as, most probably the strFiera is not recognized as the right event code, so the answer is that there are no contacs. Or maybe all the
    Code:
    '" & strFiera & "'
    has to be changed now that he input comes from a form and is not inputted in the InputBox, I do not know...

  15. #30
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Hi Giorgio,
    It doesn't work that way, simple referencing the combo will not open the form. You have some alternatives depending if you want to open the contacts form in an "unfiltered" state (to show all contacts for all events. If not and you want to open it always showing the event then the easiest is to do it similarly to the orders: the button opens the selection form with the combo and the button to open the contacts. On that selection form also add an unbound checkbox where you can select if to include the Void or not (SHOW VOID?). Comment out the code in the open event of the contacts form and edit its recordsource to take the event code and Void from the new selection form. If you want to include all events use Like Forms!NewSelectionForm!SiglaFiera & "*".
    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Opening HyperLinks from a Combobox.
    By Torinjr in forum Forms
    Replies: 3
    Last Post: 05-06-2015, 03:27 PM
  2. Replies: 5
    Last Post: 01-24-2015, 12:59 AM
  3. Dialog Form in place of InputBox
    By EddieN1 in forum Forms
    Replies: 7
    Last Post: 04-11-2014, 09:03 AM
  4. Opening form with defined combobox value
    By Kivan in forum Programming
    Replies: 2
    Last Post: 08-10-2012, 04:30 AM
  5. Opening Different Reports on Combobox Selection
    By confusedlilly19 in forum Reports
    Replies: 1
    Last Post: 06-24-2012, 03:46 PM

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