Double click of listbox on a form (2 Viewers)

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
Sirs,

Im using the below code to open a form from a listbox on a form.. this is working if one criteria only.

Can someone please add, if i have another criteria "propid" this is numeric control.. still learning to code, and i have no idea how to do it..

================================
Private Sub List104_DblClick(Cancel As Integer)

Dim strformName As String
Dim strCriteria As String

strformName = "frmPayment"
strCriteria = "[buyerID]= " & Me![List104]

DoCmd.OpenForm strformName, acNormal, , strCriteria
========================================

Any help would be appreciated..


Thank


End Sub
Any
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Feb 19, 2013
Messages
16,613
try

strCriteria = "[buyerID]= " & Me![List104] & " AND Propid=" & me.propid

assumes propid is numeric
 

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
try

strCriteria = "[buyerID]= " & Me![List104] & " AND Propid=" & me.propid

assumes propid is numeric
compile error: data member not found..
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Feb 19, 2013
Messages
16,613
presume you have a control called 'propid' and not txtPropID or similar? and you have a field called propid in your form recordsource
 

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
presume you have a control called 'propid' and not txtPropID or similar? and you have a field called propid in your form recordsource
Yes propid is in the recordsource...

SELECT [lstOnMain].[propID], [lstOnMain].[buyerID], [lstOnMain].[byrFName], [lstOnMain].[byrLName], [lstOnMain].[byrPhone], [lstOnMain].[byrStatus], [lstOnMain].[byrAgentID] FROM lstOnMain ORDER BY [propID];
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Feb 19, 2013
Messages
16,613
and the answer to the first question is? and to be clear, I mean a control on the form you are using to open frmPayment
 

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
and the answer to the first question is? and to be clear, I mean a control on the form you are using to open frmPayment
it is a listbox on a form where i launch the double click event, yes "propid" and buyerid are both there.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Feb 19, 2013
Messages
16,613
what is the revised code you are actually using? Your compile error implies it cannot find me.propid
 

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
what is the revised code you are actually using? Your compile error implies it cannot find me.propid
the one you provided above..., strCriteria = "[buyerID]= " & Me![List104] & " AND Propid=" & me.propid
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:51
Joined
Feb 19, 2013
Messages
16,613
show two screenshots:

one of the form in design view and the data properties for the propid control

the second one with the form in normal view with controls populated and the error generated
 

moi

Member
Local time
Today, 18:51
Joined
Jan 10, 2024
Messages
202
show two screenshots:

one of the form in design view and the data properties for the propid control

the second one with the form in normal view with controls populated and the error generated
Thanks a lot, i accidentaly removed the key control..
 

Users who are viewing this thread

Top Bottom