M
mbparks
Hi Tom,
I'm still having trouble with this. In your reply you have " &
me.myCasenumberControlName". My control is a text box called Case Number.
I've entered it as "myCaseNumber", "my [Case Number]", Case_Number and [Case
Number]. None are working. I get a compile error message - Expected: End of
Statement.
Please help.
I'm still having trouble with this. In your reply you have " &
me.myCasenumberControlName". My control is a text box called Case Number.
I've entered it as "myCaseNumber", "my [Case Number]", Case_Number and [Case
Number]. None are working. I get a compile error message - Expected: End of
Statement.
Please help.
Tom van Stiphout said:On Sat, 22 May 2010 22:32:01 -0700, mbparks
I'm assuming you meant "move to the record with the correct
casenumber". This is accomplished with the bookmark technique:
with me.recordsetclone
.findfirst "[case number]=" & me.myCasenumberControlName
if not .nomatch then
me.bookmark = .bookmark
end if
end with
-Tom.
Microsoft Access MVP
In the current form, move to the record with the correct case number.
Tom van Stiphout said:On Sat, 22 May 2010 18:23:01 -0700, mbparks
I'm not sure I follow you. You write: "If it is blank I would like the
existing record to open". Open how? Do you mean "open another form
with the correct casenumber preselected", or do you mean "in the
current form, move to the record with the correct casenumber"? Or?
It is nearly impossible and not recommended to use ONE control both
for lookups as for data-entry.
-Tom.
Microsoft Access MVP
My table contains a field labled "Case Number" and another field labled "Date
Completed". I have created an input form and included code to check for
duplicate case numbers. A msgbox appears with a warning. I would like the
code to check for a duplicate case number and then check the "Date Completed"
field to see if it is blank. If it is blank I would like the existing
record to open. If the date completed field is not blank I would like to
continue entering data in the form to create a new record.
The code I am currently using is:
Private Sub Case_Number_BeforeUpdate(Cancel As Integer)
If DCount("*", "Copy of DIV 3 ICT Database", "[Case Number] = '" & Me![Case
Number] & "'") > 0 Then
MsgBox "This item already exists in the table."
Cancel = True
Me.Undo
End If
End Sub
How can I incorporate the changes?
Any help is greatly appreciated.