Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    assuming fldOrigin is the recordset for the form try

    "SELECT DISTINCT " & combo1 & " FROM (" & me.recordsource & ")"

  2. #17
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    434
    Quote Originally Posted by Ajax View Post
    assuming fldOrigin is the recordset for the form try

    "SELECT DISTINCT " & combo1 & " FROM (" & me.recordsource & ")"

    this looks like the right way
    however i got the error "the table or query is not found"(something similar)

    in immediate window i got
    Code:
    SELECT DISTINCT Azienda FROM (SELECT Trattative.IDtrattativa, Trattative.CandidatoID, Aziende_1.Azienda AS [Banca candidato], Candidati.nomecognome, Comuni.Comune, Aziende.Azienda, Trattative.StatoTrattativa, Trattative.Fase, Trattative.Manager, Trattative.Nostra, Trattative.[Data inizio trattativa], Trattative.[Data fine trattativa], Trattative.[Head hunter], Trattative.[Ral nuova], Trattative.NumeroCandidatoCliente, Trattative.Note, Candidati.[ptf trasferibile personale] FROM Comuni RIGHT JOIN (Aziende AS Aziende_1 RIGHT JOIN ((Clienti RIGHT JOIN (Candidati INNER JOIN Trattative ON Candidati.IDcandidato = Trattative.CandidatoID) ON Clienti.IDCliente = Trattative.ClienteID) LEFT JOIN Aziende ON Clienti.AziendaID = Aziende.IDazienda) ON Aziende_1.IDazienda = Candidati.AziendaID) ON Comuni.IDComune = Candidati.ComuneID;)
    is there any error or i should make a query to have

    Code:
    SELECT DISTINCT Azienda FROM QUERY
    ?

    EDIT found the problem!
    i cannot use me.recordsource cause the form of the filter is not the form i want to filter, so i used "origin" variabile that is the correct recordsource
    the problem was the ";" at the end of origin, so i used this and it worked! ùù

    Code:
       Set ValuesRs = db.OpenRecordset("SELECT DISTINCT " & FldFilt & " FROM (" & Left(Origin, InStr(Origin, ";") - 1) & ");")
    THANKS!

  3. #18
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    If you recordsource includes a semi colon at the end (they aren’t actually required anyway) make sure you remove it - use the replace function

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

Similar Threads

  1. Extract text from a field
    By murleyj in forum Queries
    Replies: 7
    Last Post: 04-02-2015, 02:53 PM
  2. Update recordsource of one field on a form
    By TinaCa in forum Programming
    Replies: 1
    Last Post: 03-06-2012, 06:56 PM
  3. extract something from a field
    By tozey in forum Queries
    Replies: 4
    Last Post: 02-24-2012, 08:54 AM
  4. Extract certain values from field
    By tylerg11 in forum Programming
    Replies: 19
    Last Post: 09-23-2011, 03:27 PM
  5. Set Label.Caption to field of recordsource
    By ngruson in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 09:59 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