T
tom
This is a database designed to be used by a data entry person. I plan
on eliminating the normal navigation buttons on the menu bar so that
the only button that appears to the data entry person is a "Close"
Button.
The problem that I'm having is that the "Close" button will not
function the same way as the record advance button does on the
standard menu bar.
The Form is designed to prevent duplicate dates from being entered. I
accomplished this by adding indexing and no duplicates to the date
field. When advancing to the next record with the menu bar everything
works fine (A message pops up telling the user that there is a problem
with the date.) However, when using the Close button, the Form
closes, it doesn't save the record BUT it doesn't notify the user
there was a problem. I am SO NEW to this, I've never done ANYTHING in
VBA but I read thru this forum and found the exact same problem
described and a solution. However the solution I believe has some
syntax errors and maybe even some logic I don't want. Anyhow I can't
get it to work at all because of syntax problems. Can anyone help?
Here is the code below. The first part of the IF statment seems just
what I want to do, however the ELSE part of the statement I'm not
sure. All I want it to do, if the date is NOT duplicated is to
advance to the next field. Sigh..... any help would be appreciated.
If DCount("[IndexedFieldName]", "TableName") > 1 then
msgbox "Duplicate entry. Record will not be saved."
undo the current record
else
save the record
close the form
on eliminating the normal navigation buttons on the menu bar so that
the only button that appears to the data entry person is a "Close"
Button.
The problem that I'm having is that the "Close" button will not
function the same way as the record advance button does on the
standard menu bar.
The Form is designed to prevent duplicate dates from being entered. I
accomplished this by adding indexing and no duplicates to the date
field. When advancing to the next record with the menu bar everything
works fine (A message pops up telling the user that there is a problem
with the date.) However, when using the Close button, the Form
closes, it doesn't save the record BUT it doesn't notify the user
there was a problem. I am SO NEW to this, I've never done ANYTHING in
VBA but I read thru this forum and found the exact same problem
described and a solution. However the solution I believe has some
syntax errors and maybe even some logic I don't want. Anyhow I can't
get it to work at all because of syntax problems. Can anyone help?
Here is the code below. The first part of the IF statment seems just
what I want to do, however the ELSE part of the statement I'm not
sure. All I want it to do, if the date is NOT duplicated is to
advance to the next field. Sigh..... any help would be appreciated.
If DCount("[IndexedFieldName]", "TableName") > 1 then
msgbox "Duplicate entry. Record will not be saved."
undo the current record
else
save the record
close the form