R
rgrantz
I have code set in BeforeUpdate to check for the existence of an existing
record, tell the user the record exists, and then go to that record. The
code follows:
Dim PSNumFind As String
PSNumFind = Me.PSNum
If (DCount("*", "KitOrders", "[PSNum]=""" & Me.PSNum & """") > 0) Then
MsgBox "That Packing Slip already Entered!"
Me.Undo
DoCmd.FindRecord PSNumFind
End If
I was getting a bunch of errors about setting focus and not being able to
reference field properties/data for the findrecord function when the control
is disabled, and also not being able to leave the record because that
field's required property i set to true. I thought that setting a variable
to the control's contents would do the trick (using the variable as the
criteria string rather than the control's contents), but I now get error #
2137 ("You can't use Find/Replace Now") at the FindRecord line.
I've made msgboxes that shw the value of PSNumFind at the END of this
procedure, and it IS correct and holding the value in PSNum. What can I do
to get this thing to go to the record that exists based on the value in
PSNum?
Possibly a clue as to problem: It smetimes works, but then if the form is
closed and then reopened, I start getting the errors again when entering new
(existing) record, and I notice that in the Filter property of the form, it
is set to [PSNum] = ". When I clear this, it works again until the form
closed and opened again, and an exiusting PSNum is entered in a new record.
Thanks for reading, and Please Help!
record, tell the user the record exists, and then go to that record. The
code follows:
Dim PSNumFind As String
PSNumFind = Me.PSNum
If (DCount("*", "KitOrders", "[PSNum]=""" & Me.PSNum & """") > 0) Then
MsgBox "That Packing Slip already Entered!"
Me.Undo
DoCmd.FindRecord PSNumFind
End If
I was getting a bunch of errors about setting focus and not being able to
reference field properties/data for the findrecord function when the control
is disabled, and also not being able to leave the record because that
field's required property i set to true. I thought that setting a variable
to the control's contents would do the trick (using the variable as the
criteria string rather than the control's contents), but I now get error #
2137 ("You can't use Find/Replace Now") at the FindRecord line.
I've made msgboxes that shw the value of PSNumFind at the END of this
procedure, and it IS correct and holding the value in PSNum. What can I do
to get this thing to go to the record that exists based on the value in
PSNum?
Possibly a clue as to problem: It smetimes works, but then if the form is
closed and then reopened, I start getting the errors again when entering new
(existing) record, and I notice that in the Filter property of the form, it
is set to [PSNum] = ". When I clear this, it works again until the form
closed and opened again, and an exiusting PSNum is entered in a new record.
Thanks for reading, and Please Help!