Open form/record with Listbox selection

hawg1

Registered User.
Local time
Today, 18:23
Joined
Sep 24, 2006
Messages
51
Hi,

Need help on a list box issue. Solution is probably real simple, just can't see it with my bleary eyes.

I have a form (INSTLKP) with only a list box (List6) based on a table ((tblPersData) with fields PersdataID; SSN; Last; First; MI) on it. When I open the form up, the listbox does display all records associated withthe table. I would like to doubleclick on a desired SSN in the list box and have that record open up in a form (Perssub1) in edit mode.

And that is where the rub is... I have the following code in the On doubleclick event of List6

Code:
Private Sub List6_DblClick(Cancel As Integer)

DoCmd.OpenForm "Perssub1", , , "[PersDataID]= " & Me.List6, , acWindowNormal

End Sub

All it does it just open a blank Perssub1 form. Any ideas on what I'm missing?

:confused: Hawg1
 
I have the boundcolumn set to 0. I think it is right since the first field in the table is PersDataID type autonumber. It still isn't showing the record, just a blank form


macca the hacke said:
Is the bound column on the list box set to be the same field as PersDataID?
 
I think you should change the bound column to 1 - as far as I am aware the first column is 1 and not 0
 
I tried that also. still just a blank form. I just don't know what is wrong. It's opening the right form, just not going tothe right record.

macca the hacke said:
I think you should change the bound column to 1 - as far as I am aware the first column is 1 and not 0
 
dcmaloney,

Thanks for the advice and the shortcut to the other thread. At first it didn't work. So I created another DB from and started from scratch again. That time it did work.

After carefull scrutiny of the form properties, I discovered that I had the 'DataEntry' field toggled to YES. Switched it to NO and voila, all is good!

Again thanks for the help


Hawg1:) :) :) :)


dcmaloney said:
I was having this same issue and found the following post. It worked for me it might work for you.

http://www.access-programmers.co.uk/forums/showthread.php?t=114866&highlight=DoCmd.OpenForm
 

Users who are viewing this thread

Back
Top Bottom