Y
Yblitzka
I have a form that pops up with a filter on it. It gets the filter setting
from another form that's already loaded.
frmOrder has a RefNum field that Me (the form I'm opening) uses as it's
OrderID field. I set up the filter on FormLoad.
The thing is, if the OrderID has nothing in tblOrderShip associated with it
yet, I need to open the form with a blank record, which it does fine, and it
needs to fill in the OrderID field. The easiest way I could think to do this
was with a DCount function. If DCount of a particular OrderID came up with
nothing, then I'd fill in the field and set the filter.
So I've gotten this far:
If DCount("[ErrorID]", "[tblOrderShip]", "[OrderID] = '" &
Forms![frmOrderEntry]![RefNum] & "'") = 0 Then (check DCount)
Me![OrderID] = Forms![frmOrderEntry]![RefNum] (set OID)
Me![ShipToPhone] = Now() (set another field)
Else
Me.Filter = "[OrderID] = " & Forms![frmOrderEntry]![RefNum] (set the filter)
Me.FilterOn = True
OrderID and RefNum are number fields, and I've tried the DCount with and
without the Forms![frmOrderEntry]![RefNum] in single quotes.
Any help?
~Yb
But I get the error in the title whenever I run the program - Previous
Operation canceled. I know this has something to do with the DCount in there,
but I can't figure it out.
from another form that's already loaded.
frmOrder has a RefNum field that Me (the form I'm opening) uses as it's
OrderID field. I set up the filter on FormLoad.
The thing is, if the OrderID has nothing in tblOrderShip associated with it
yet, I need to open the form with a blank record, which it does fine, and it
needs to fill in the OrderID field. The easiest way I could think to do this
was with a DCount function. If DCount of a particular OrderID came up with
nothing, then I'd fill in the field and set the filter.
So I've gotten this far:
If DCount("[ErrorID]", "[tblOrderShip]", "[OrderID] = '" &
Forms![frmOrderEntry]![RefNum] & "'") = 0 Then (check DCount)
Me![OrderID] = Forms![frmOrderEntry]![RefNum] (set OID)
Me![ShipToPhone] = Now() (set another field)
Else
Me.Filter = "[OrderID] = " & Forms![frmOrderEntry]![RefNum] (set the filter)
Me.FilterOn = True
OrderID and RefNum are number fields, and I've tried the DCount with and
without the Forms![frmOrderEntry]![RefNum] in single quotes.
Any help?
~Yb
But I get the error in the title whenever I run the program - Previous
Operation canceled. I know this has something to do with the DCount in there,
but I can't figure it out.