Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox on Popup Form 1

Status
Not open for further replies.

cneill

Instructor
Mar 18, 2003
210
GB
Hi,

I am having a bad day, just can't get this to work.

I have a main form called FrmSchemes
I select a scheme from the form which opens up a Popup Form
so far so good

On the popup Form is a Listbox, I want to open A selected record from the listbox on another popup form
I have tried useing
=[ExpenseHistory].[Column](0) in a hidden text box (on the first popup form)so that the query on the new popup form can reference the CostID
No Luck, I am sure there is another way of doing this any thoughts please?
 
Let me make sure I have this strait. 2 forms, one with a combobox or listbox where you select your scheme. The second form has a list box. On the second form, you want to open a record based on the scheme selected in the first form? Or is there a third form involved? From your wording, I THINK you mean 2 forms, but it sounds more like 3 forms.
 
Hi kyv1611

Main Form FrmSchemes has a combo box you make a selection after seleting a button appears.
When you press the button the first popup from opens to allow you to add a in record.On this first popup form there is a Listbox showing you the history of all the entry you have made. (this works fine) Now I what to click on the listbox of the first popup form to open a second popup form to show you the details of the record you have selected on the first popup form

Hope this makes sence
Thanks
cneill
 
Okay. It sounds like you need to reference the item from the listbox... I THINK it's something like ListBox.SelectedItem or ListBox.SelectedItems(0)...

I know it's along those lines...

So, you could do something like:
Code:
Private Sub MyListBox_Click()
  Dim strSQL As String
  strSQL = "SELECT t.* FROM MyTable t WHERE t.Field = '" & MyListBox.Selected & "'"
  DoCmd.OpenForm NextPopUp
  NextPopUp.RowSource = strSQL
  DoCmd.OpenForm NextPopUp
End Sub

This is definitely just pseudo-code, as I've not taken the time to plug it into Access. The .Selected may be different, I never can seem to remember the way it's supposed to be referenced..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top