OK I decided to eliminate the need for the popup form and use the list box AddItem and RemoveItem to achieve the same effect. I found some code on google which seems it the right direction but it needs some help...
Private Sub lsteIndexFields_DblClick(Cancel As Integer)
Dim az As Integer
Dim strInput As String
Dim Item As Object
Dim Index As Integer
az = Me.lsteIndexFields.Items.IndexOf(Me.lsteIndexFields.SelectedItem)
Item = Me.lsteIndexFields.Items.Item(az)
Index = Me.lsteIndexFields.Items.IndexOf(Item)
strInput = InputBox("Edit This Item")
Me.lsteIndexFields.Items.RemoveItem (ListBox1.SelectedItem)
Me.lsteIndexFields.Items.AddItem(index, strInput)
End Sub
I need to put the selected item into the inputbox, change it and save it back. This is not VBA but it seems close. Can someone please give me and idea?
With Warm Regards,
Art,
You have officially lost me 😉.
What is the "input box function" that populates the list box? What do you mean by "populates"?
I guess I need a more complete picture of what you are attempting to do in order to provide assistance since I'm making a ton of false assumptions. Maybe someone else has a better grasp of your forms and can help.
Regards,
Duane
Sent: Monday, December 11, 2017 2:48 PM
To: Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]
Subject: Re: [MS_AccessPros] Populate Textbox On Another Form From Listbox,
With Warm Regards,
Art,
You said you tried "Refesh". What did you refresh? Did you try Requery the list box? This will only make a difference after the record in the table has been saved.
I have also used:
[Forms]![frmCabinetDetailsNew]![lsteIndexFields].RowSource = [Forms]![frmCabinetDetailsNew]![lsteIndexFields].RowSource
You could also open the second form in acDialog mode and add a line to requery the list box after the line to open the form.
Regards,
Duane Hookom
Sent: Monday, December 11, 2017 2:02 PM
To: Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]
Subject: Re: [MS_AccessPros] Populate Textbox On Another Form From Listbox,
With Warm Regards,
Hi Art,
You might want to try:
[Forms]![frmCabinetDetailsNew]![lsteIndexFields].Requery
I'm not sure why you are updating the list box but as long as you understand it's good with me.
Regards,
Duane
Sent: Monday, December 11, 2017 12:42 PM
To: Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]
Subject: Re: [MS_AccessPros] Populate Textbox On Another Form From Listbox,
I got it to work when I am opening up the second for to edit the indexfield but after the edit when I want to update the listbox I tried this:
Private Sub cmdSave_Click()
If Not SaveIt() Then Exit Sub ' this is a save function
[Forms]![frmCabinetDetailsNew]![lsteIndexFields].Form.Requery
' Close me
DoCmd.Close acForm, Me.Name
End Sub
But it error's out with Object doesn't support this property or method
With Warm Regards,
Sent: Sunday, December 10, 2017 6:59:20 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Populate Textbox On Another Form From Listbox,
I have a form called frmeCabinetDetailsNew and on it I have a listbox called lsteIndexField. If the user double clicks on a item in the list box I need to open up a from called frmeindexField which has a textbox called txtIndexField and populate it with the selected item from the listbox on the other form for editing. Once its edited I need to save the changes back to frmeCabinetDetailsnew.lsteIndexField. Any ideas?
Thank you,
Art Lorenzini
SD
Posted by: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (13) |
Tidak ada komentar:
Posting Komentar