Hi,
I was hoping someone could explain why the following code does not work. Hopefully it is enough to go on.
I would like a form, on opening, to run some code if there is an OpenArg value. In the code below me.MyIssueID is the OpenArg. I am trying to populate an unbound control with table values. If you need more, just let me know but perhaps it is something dead obvious. Thanks in advance.
PS. You can see I've added some msgbox for troubleshooting. I see the first one (IssueIDx) but NONE of the others. Seems we are not even getting that far.
Private Sub Form_Activate()
Dim IssueIDx As Integer
Dim ProductIDx As Integer
Dim ProductNamex As String
IssueIDx = Me.MyIssueID
MsgBox IssueIDx
If len(IssueIDx) > 0 Then
ProductIDx = DLookup("[ProductID]", "tblIssue", "[MyIssueID = IssueIDx]")
MsgBox ProductIDx
ProductNamex = DLookup("[ProductName]", "tblProduct", "[MyProductID = ProductIDX]")
Me.ProductID = ProductNamex
MsgBox ProductNamex
Else
Me.MyIssueID.Requery
MsgBox "Else"
End If
End Sub
I was hoping someone could explain why the following code does not work. Hopefully it is enough to go on.
I would like a form, on opening, to run some code if there is an OpenArg value. In the code below me.MyIssueID is the OpenArg. I am trying to populate an unbound control with table values. If you need more, just let me know but perhaps it is something dead obvious. Thanks in advance.
PS. You can see I've added some msgbox for troubleshooting. I see the first one (IssueIDx) but NONE of the others. Seems we are not even getting that far.
Private Sub Form_Activate()
Dim IssueIDx As Integer
Dim ProductIDx As Integer
Dim ProductNamex As String
IssueIDx = Me.MyIssueID
MsgBox IssueIDx
If len(IssueIDx) > 0 Then
ProductIDx = DLookup("[ProductID]", "tblIssue", "[MyIssueID = IssueIDx]")
MsgBox ProductIDx
ProductNamex = DLookup("[ProductName]", "tblProduct", "[MyProductID = ProductIDX]")
Me.ProductID = ProductNamex
MsgBox ProductNamex
Else
Me.MyIssueID.Requery
MsgBox "Else"
End If
End Sub