Z
zSplash
Okay, my searchForm finds a bunch of records ("resultList"). I want to be
able to select one of the records in the resultList to open the MainForm at
that record. On the left-hand part of the list, I have the pk_ID of the
record, and want a double-click on the pk_ID of the desired record will open
the MainForm at that record.
Here's the code I'm using on the double-click event:
Private Sub pk_ID_DblClick(Cancel As Integer)
Dim foundID 'As Long 'String
foundID = ActiveControl.OldValue
Form_1MainForm.getResult foundID
End Sub
I've declared foundID in the 1MainForm module (Public foundID as Long), but
the variable isn't recognized in the Form_Search module, so I declared it
there, too. Then, when I get to the 1MainForm module, I set
foundID=foundID, but it is lost when I get into another sub. (This must be
a basic programming error I've never encountered before, eh?)
Anyway, when I get to the 1MainForm module, here's my code:
Sub getResult(foundID)
foundID = foundID
DoCmd.OpenForm "1MainForm", acNormal, , , , , foundID
Form_Load
End Sub
Private Sub Form_Load()
foundID = "115" 'set it because I lost it
foundID = CLng(foundID)
strWhere = "[1MainForm].[pk_ID]=" & foundID
DoCmd.OpenForm "1Mainform", WhereCondition:=strWhere
End Sub
I get an error asking for the parameter "1MainForm.pkID". So, seems like it
doesn't recognize 1MainForm.pk_ID as the field which I've related from the
Form_Search module.
UffDah. Can anybody lead me back?
TIA
able to select one of the records in the resultList to open the MainForm at
that record. On the left-hand part of the list, I have the pk_ID of the
record, and want a double-click on the pk_ID of the desired record will open
the MainForm at that record.
Here's the code I'm using on the double-click event:
Private Sub pk_ID_DblClick(Cancel As Integer)
Dim foundID 'As Long 'String
foundID = ActiveControl.OldValue
Form_1MainForm.getResult foundID
End Sub
I've declared foundID in the 1MainForm module (Public foundID as Long), but
the variable isn't recognized in the Form_Search module, so I declared it
there, too. Then, when I get to the 1MainForm module, I set
foundID=foundID, but it is lost when I get into another sub. (This must be
a basic programming error I've never encountered before, eh?)
Anyway, when I get to the 1MainForm module, here's my code:
Sub getResult(foundID)
foundID = foundID
DoCmd.OpenForm "1MainForm", acNormal, , , , , foundID
Form_Load
End Sub
Private Sub Form_Load()
foundID = "115" 'set it because I lost it
foundID = CLng(foundID)
strWhere = "[1MainForm].[pk_ID]=" & foundID
DoCmd.OpenForm "1Mainform", WhereCondition:=strWhere
End Sub
I get an error asking for the parameter "1MainForm.pkID". So, seems like it
doesn't recognize 1MainForm.pk_ID as the field which I've related from the
Form_Search module.
UffDah. Can anybody lead me back?
TIA