I have a tbl Orders and its form Orders from where I open/make Proformas (tbl Proformas, form Proformas) in tbl Proformas I have OrderId that comes from tbl Orders, of course.
Now when I try to open/make a proforma with this:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Proformas"
stLinkCriteria = "[Proformas_OrderId] = " & Me![OrderId]
If IsNull(stLinkCriteria) Then
DoCmd.OpenForm stDocName, , , , acFormAdd
Forms!Proformas.Form!ProformasOrderIdctrl = Me.OrderId
MsgBox "unexistant value"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
MsgBox "exists"
End If
It always tries to open an existant record although and I get an empty form Proformas with the msgBox 'exists'. Why isn't it getting if the stLinkCriteria exists? Should I filter it otherwise?
Now when I try to open/make a proforma with this:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Proformas"
stLinkCriteria = "[Proformas_OrderId] = " & Me![OrderId]
If IsNull(stLinkCriteria) Then
DoCmd.OpenForm stDocName, , , , acFormAdd
Forms!Proformas.Form!ProformasOrderIdctrl = Me.OrderId
MsgBox "unexistant value"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
MsgBox "exists"
End If
It always tries to open an existant record although and I get an empty form Proformas with the msgBox 'exists'. Why isn't it getting if the stLinkCriteria exists? Should I filter it otherwise?