DoCmd.OpenForm ?????

Lister

Z Shift
Local time
Today, 18:42
Joined
Aug 24, 2003
Messages
305
Code:
Private Sub List6_DblClick(Cancel As Integer)

DoCmd.OpenForm "frmCDPAMembers", acNormal, , "LiftersID=' " & Me.List6 & "'"

End Sub

I have a list box that I have used may times, but this time after three hours I just can't get a new one to work.
The list boxs is controled by the same query that controls the form I wish to open "frmCDPAMembers".
So I made a list box (list6) two columns, MembersNames & LiftersID. And used the code above.
The Bound Column is 2 but I tried 1 any way, hell I have tried alot of things in the past hour.
But it just wont open the form!
I just keep getting Runtime error '2501'
The OpenForm action was canceled.

I have checked code form other db's and I just can't see what the hell I am doing wrong this time.
So if anyone can see error's in the code please let me know before I give up programing and take up Tai-bo.

Thanks
 
With listboxes, the bound column numbers begin at 1 for the 1st column (unlike many other Access collections where they begin at 0). If the LiftersID field contains numbers, then you don't need the ' ' string delimiters:
Code:
DoCmd.OpenForm "frmCDPAMembers", acNormal, , "LiftersID=" & Me.List6
 
DoCmd.OpenForm "frmCDPAMembers", , , "[LiftersID]='" & [List6] & "'"
 
Thanks

Thanks for the replys guys.
I didn't try either of those ideas last night. I will give them ago when I get home.
:)
 
Worked like a charm dcx, thanks for the help :)
 

Users who are viewing this thread

Back
Top Bottom