List Box to Open New Form

racer25

Slowly Getting There
Local time
Today, 09:28
Joined
May 30, 2005
Messages
65
Hi,

Apologies if this has been answered before I did try searching and implementing/amending some other solutions - but probably down to my own level of expertise could not get working.

The problem I have is;

I have a form with a Listbox63 within the Listbox are the fields surname and firstname. I would like the end-user to be able to double click on one of the rows and it opens a form called "Personal Details" at goto the record selected so that the user can edit this entry in the form.

I would appreciate any help anyone can offer.

Cheers,

Rob
 
Put the following code behind your Double Click Event

Code:
Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FRM_Name" 'Name of your for that is to be opend
    
    stLinkCriteria = "[PersonalDtlID]=" & Me![PersonalDtlID] 'The common key that links the current record and the record that is to be opend in the form
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,
 
Hi everyone,

I'm having the exact same problem as racer25.

I tried the code above by luddite_lad, but it didn't quite work. Maybe I set it up incorrectly?

On the double click property, I linked it to a macro. In the macro, I added a row - RunCode. I set the RunCode to run a function.

I entered the code in the function, but the last line does not work. It gives an error - Compile Error: Expected expression

Can anyone else suggest some solutions. Preferably something that doesn't use VB as I am not very good at it.

Can't you use the Value property of a listbox and then create a separate query to open in another form?

Thanks!
 
Thanks for the info, it didn't seem to work

I get syntax error on the line DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,

Code:
Private Sub List72_DblClick(Cancel As Integer)

Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Personal Details" 'Name of your for that is to be opend
    
    stLinkCriteria = "[Uniqueid]=" & Me![Uniqueid] 'The common key that links the current record and the record that is to be opend in the form
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , ,

End Sub
 
Sorry guys try this;

Code:
Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Personal Details" 'Name of your form that is to be opened
    
    stLinkCriteria = "[Uniqueid]=" & Me![Uniqueid] 'The common key that links the current record and the record that is to be opened in the form
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "OpenArgs"

when I was renaming the controls I took the OpenArgs of the end of the DoCmd, I didn't realise at the time that it was a critical expression :o

Racer25 you may want to look at the naming convention you are using to name your tables, forms etc. For example look at changing Personal Details to something like FRM_PersonalDetails
 
Editing Details on ListBox

On my form, I have a listbox. When i select a row in the listbox and click the edit button i would like the form to open with the details of the selected row.

I tried the code below but the form only opens. The data selected from the row doesnt show .....
How do i get the details to show?




Sorry guys try this;

Code:
Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Personal Details" 'Name of your form that is to be opened
    
    stLinkCriteria = "[Uniqueid]=" & Me![Uniqueid] 'The common key that links the current record and the record that is to be opened in the form
    DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "OpenArgs"
when I was renaming the controls I took the OpenArgs of the end of the DoCmd, I didn't realise at the time that it was a critical expression :o

Racer25 you may want to look at the naming convention you are using to name your tables, forms etc. For example look at changing Personal Details to something like FRM_PersonalDetails
 

Users who are viewing this thread

Back
Top Bottom