QUOTE (Doug Steele @ May 28 2012, 11:10 PM)

CODE
Dim rs As Object
If IsNull(Me.OpenArgs) = False Then
Set rs = Me.Recordset.Clone
rs.FindFirst "[TransactionID] = " & CLng(Me.OpenArgs)
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End If
To go back to your old approach, is there some way you can add the name of the field to the list box?
CODE
Private Sub lstTransactions_DblClick(Cancel As Integer)
Dim strName As String
Dim strFieldName
Dim lngID As Long
On Error GoTo Form_Error
If Me.lstTransactions.ItemsSelected.Count = 0 Then
MsgBox " No Transaction selected", vbExclamation
Else
strName = Me.lstTransactions.Column(2)
lngID = Me.lstTransactions.Column(1)
strFieldName = Me.lstTransactions.Column(3)
DoCmd.OpenForm strName, acNormal, ,"[" & strFieldName & "] = " & lngID , acFormEdit, acDialog
End If
Form_Exit:
Exit Sub
Form_Error:
MsgBox " Error:" & Err.Description
Resume Form_Exit
End Sub
Hello Doug
We live in different continents and time zones sorry for the late reply
your proposal worked .
To get the field name, i used an expression like
CODE
Me.ControlName.ControlSource
And since i am doing it for different forms, i developed a class module(for sake of learning them) below
CODE
'---------------------------------------------------------------------------------------
' Module : Class1
' Author : Admin
' Date : 27/05/2012
' Purpose : tracks transactions and list them on a listbox control
'---------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Public t_ID As Long '''transactionID
Public t_Name As String ''''TransactionName
Public frmName As String ''''form where transaction recorded
Public fdlName As String
Private Property Get TransactionID() As Long
TransactionID = t_ID
End Property
Private Property Get TransactionName() As String
TransactionName = t_Name
End Property
Private Property Get FormName() As String
FormName = frmName
End Property
Private Property Let TransID(ID As Long)
ID = t_ID
End Property
Private Property Let TransName(myName As String)
myName = t_Name
End Property
Private Property Let frm_Name(anyName As String)
anyName = frmName
End Property
Private Property Get FieldName() As Long
FieldName = fdlName
End Property
Private Property Let myName(anyFieldName As String)
anyFieldName = fdlName
End Property
and this how i call it in one of the forms
I declared a module variable
CODE
Public t_Transactions As clsTransactions
and this is the code in one of the forms
CODE
Private Sub Form_AfterUpdate()
Dim db As dao.Database
Dim rst As dao.Recordset
Set t_Transactions = New clsTransactions
t_Transactions.t_ID = Me.TransactionID
t_Transactions.frmName = "frmProcessBOQS"
t_Transactions.t_Name = Me.ContractID.Column(1) & " LBC Instructions "
t_Transactions.fdlName = Me.ID.ControlSource
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblTempTransactions", dbOpenDynaset)
With rst
.AddNew
!TransactionID = t_Transactions.t_ID
!FormName = t_Transactions.frmName
!TransactionType = t_Transactions.t_Name
!FieldName = t_Transactions.fdlName
.Update
End With
rst.Close
Set t_Transactions = Nothing
Set rst = Nothing
Set db = Nothing
End Sub