Hi!
I'm trying this to see if I need to make a new record or I just open the existing one:
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 there isn't, 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?
PS: tbl Proformas has the OrderId from tbl Orders and this command comes from the Orders form.
I'm trying this to see if I need to make a new record or I just open the existing one:
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 there isn't, 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?
PS: tbl Proformas has the OrderId from tbl Orders and this command comes from the Orders form.