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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open form based on record in a list box 2

Status
Not open for further replies.

chunk22

IS-IT--Management
Mar 5, 2005
23
GB
Dear all,

I have a form with a list box that based on a query (row source) to enable a user to search for records on a particaular day. I want to be able them to dblclick an entry in a list box (Date, time, serial no)and open the related form based on the unique serial no. that will deplay all the details related to that record in the main inputing form.

Can anyone help.

Many thanks

Chunk22
 
Have a single form that will open on the dbl_click of the listbox, pass the serial number via a variable to a query that runs on load of the second form. The controls on the second form can be populted from the results of that query.

Hope that helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
Hi Harleyquinn,

Thank you for your response, that does help with a possible solution however I would rather use on generic form so is there anyway that the main form can be opened based on the serial no in a list box?

Thanks again all

Chunk22
 
That's what I meant in my post. You would just pass the variable to the generic form, use a query including the parameter passed from the listbox and the data displayed would change each time you choose a new value.

Harleyquinn

---------------------------------
For tsunami relief donations
 
Sorry I seem to be confusing you all, please accept my apologies, i'll just recap. There is one generic form which is used for displaying and
inputing data, a button on that form will open a box that asks for a date(criteria in query) and there results are displayed in a list box on a seperate
form, the main form is still open in the background. What the user will do is double click the relavent entry and that will be displayed in the the main form (the form will jump to that record (serialNo).

Sorry and thanks

Chunk22
 
They are fields in a table (control source)

chunk22
 
How about when you double click in the listbox you update the recordsource of the main form to be something like:
Code:
frm_Main.recordsource = "SELECT * FROM <YOURTABLE> WHERE SERNO = '" & Value & "'"
With your value being the selected item in the listbox.

That should automatically update the fields

Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
Or do a .findfirst on it's recordsource, perhaps something like this:

[tt]dim rs as dao.recordset
dim frm as form
set frm=forms("frmMain")
set rs=frm.recordsetclone
rs.findfirst "SerialNo = " & clng(me!lstMyList)
if not rs.nomatch then frm.bookmark=rs.bookmark
set rs=nothing
set frm=nothing[/tt]

Roy-Vidar
 
Excellent Roy-Vidar that works great, just one other possible solution is required. Would it be possible to make this work if the main form is not open already, Senario, button on switchboard that is called Search click that and then they enter a data which open the list box with all speciific dates then they click the one they want and the form opens at that record only.

Chunk22
 
If 2000+ versions, you could try:

[tt]if currentproject.allforms("frmMain").isloaded then
' form is loaded
else
' docmd.openform...
end if[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top