Results 1 to 10 of 10
  1. #1
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409

    find a control in a continuos form

    hi
    i'd like to get the value i marked in the picture, it's the second record; consider that the value you see is the column(1) of the combobox(so i can't loop using me.recordsetclone cause i can't use rs!combobox.column(1))

    how can i do that? i found something about looping throgh controls in a form but it didn't work

    Click image for larger version. 

Name:	Immagine 2022-04-08 175919.png 
Views:	30 
Size:	18.7 KB 
ID:	47650

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try using GoToRecord to go to the desired record and then using the combo reference to get the value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you already know the name: cboName
    you dont use recordset field, call it by the control name.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    I think the easiest would be a simple dLookup on the combo's row source.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    thanks very much, i used a recordset based on a query, with dlookup will be a really mess cause i had to make a three time nested dllookup at least

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Could you post a small sample with just the objects involved and some dummy data to illustrate the issue?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    it's not that big deal, it's just a form (a single event calendar) with subform (people involved in the event); the subform has some fields, the name of the partecipant, the qualification (customer, applicants etc etc) and the Deal, that is unique for every applicant but is related to a customer and the customer is related to a company
    this is the query i use (instead of dlookup) to get the name of my customer relaterd to the deal

    Code:
    "SELECT Aziende.Azienda " & vbCrLf & _                             "FROM Aziende INNER JOIN ((Trattative INNER JOIN Partecipanti ON Trattative.IDtrattativa = Partecipanti.TrattativaID) INNER JOIN Clienti ON Trattative.ClienteID = Clienti.IDCliente) ON Aziende.IDazienda = Clienti.AziendaID " & vbCrLf & _
                                 "WHERE (((Partecipanti.CalendarioID)=" & Me.IDCalendario & "));")

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,945
    You can retrieve more than one data item with a single DlookUp() as long as the criteria remains the same?
    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. #9
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    if i understood, the answer is no. You can get just one data item with dlookup. Speaking of my case, it's just laziness, it's a bit tricky to use dlookup in this case and use recordest is a shorter way that works perfectly...

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,945
    Quote Originally Posted by diegomarino View Post
    if i understood, the answer is no. You can get just one data item with dlookup. Speaking of my case, it's just laziness, it's a bit tricky to use dlookup in this case and use recordest is a shorter way that works perfectly...
    Incorrect.

    Code:
    var = Nz(DLookup("[Field1] & '|' & [Field2]", "tblRma", "[Field3]= " & Me.MyTextboxName), "")
    Code:
    ? dlookup("Client & '|' & CMS", "Emails", "ID=3")
    Mrs J.Firth:125521|125521
    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

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Button image in continuos form
    By diegomarino in forum Access
    Replies: 18
    Last Post: 10-16-2020, 12:19 PM
  2. continuos form not more refreshing
    By diegomarino in forum Access
    Replies: 7
    Last Post: 05-05-2020, 09:52 AM
  3. Replies: 6
    Last Post: 04-16-2018, 09:15 PM
  4. filters in continuos form using VBA code
    By TriFith in forum Access
    Replies: 5
    Last Post: 01-11-2017, 04:48 AM
  5. Sum textbox in continuos form
    By cuongmyh in forum Forms
    Replies: 2
    Last Post: 02-27-2015, 10:12 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