If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
unbound listbox... how do i make the current record selected
I have a listbox that displays the name of all the records, as I use the
navigation buttons to go through different records my listbox does not update what it has selected. My listbox is unbound and here are some things you might want to know: Row Source: SELECT InspectionsDI.ID, InspectionsDI.[Manhole Number] FROM [InspectionsDI Query]; Private Sub lstDI_AfterUpdate() DoCmd.GoToRecord acDataForm, "DropInletForm", acGoTo, lstDI.ListIndex + 1 End Sub Thanks for help |
#2
|
|||
|
|||
unbound listbox... how do i make the current record selected
"dannie" wrote in message
... I have a listbox that displays the name of all the records, as I use the navigation buttons to go through different records my listbox does not update what it has selected. My listbox is unbound and here are some things you might want to know: Row Source: SELECT InspectionsDI.ID, InspectionsDI.[Manhole Number] FROM [InspectionsDI Query]; Private Sub lstDI_AfterUpdate() DoCmd.GoToRecord acDataForm, "DropInletForm", acGoTo, lstDI.ListIndex + 1 End Sub Thanks for help Is it that you want the list box to automatically show as selected the record that is current? If the bound column of the list box is the first column (the ID field), then you might use this code in the form's Current event: '------ start of code ------ Private Sub Form_Current() Me.lstDI = Me!ID End Sub '------ end of code ------ -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#3
|
|||
|
|||
unbound listbox... how do i make the current record selected
"dannie" wrote in message
... I have a listbox that displays the name of all the records, as I use the navigation buttons to go through different records my listbox does not update what it has selected. My listbox is unbound and here are some things you might want to know: Row Source: SELECT InspectionsDI.ID, InspectionsDI.[Manhole Number] FROM [InspectionsDI Query]; Private Sub lstDI_AfterUpdate() DoCmd.GoToRecord acDataForm, "DropInletForm", acGoTo, lstDI.ListIndex + 1 End Sub Thanks for help Incidentally, I would probably do this somewhat differently, so that I would have an option to sort the list box or the form differently: Private Sub lstDI_AfterUpdate() With Me.lstDI If Not IsNull(.Value) Then Me.Recordset.FindFirst "ID = " & .Value End If End With End Sub By making the navgation data-based, rather than sequence-based, you avoid having problems if the list box and form aren't sorted the same way. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#4
|
|||
|
|||
unbound listbox... how do i make the current record selected
I tested that out and it worked great, now I need to figure out how to do it
from my code module because my OnCurrent event has a function name which calls a function from a module. I dont know how to have it call that function and do a event procedure. "Dirk Goldgar" wrote: "dannie" wrote in message ... I have a listbox that displays the name of all the records, as I use the navigation buttons to go through different records my listbox does not update what it has selected. My listbox is unbound and here are some things you might want to know: Row Source: SELECT InspectionsDI.ID, InspectionsDI.[Manhole Number] FROM [InspectionsDI Query]; Private Sub lstDI_AfterUpdate() DoCmd.GoToRecord acDataForm, "DropInletForm", acGoTo, lstDI.ListIndex + 1 End Sub Thanks for help Is it that you want the list box to automatically show as selected the record that is current? If the bound column of the list box is the first column (the ID field), then you might use this code in the form's Current event: '------ start of code ------ Private Sub Form_Current() Me.lstDI = Me!ID End Sub '------ end of code ------ -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#5
|
|||
|
|||
unbound listbox... how do i make the current record selected
"dannie" wrote in message
... I tested that out and it worked great, now I need to figure out how to do it from my code module because my OnCurrent event has a function name which calls a function from a module. I dont know how to have it call that function and do a event procedure. Call the function from the event procedure, before or after new code for the event. For example: '------ start of code ------ Private Sub Form_Current() Me.lstDI = Me!ID Call YourFunction() End Sub '------ end of code ------ -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|