If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Unique entry
I pasted this:
Private Sub Symbol_ID_BeforeUpdate(Cancel As Integer) If DCount("*", "Borrowing", _ "[Symbol ID]='" & Nz(Me![Symbol ID].Value, "") & "'") 0 Then MsgBox "The value already exists!" Cancel = True End If End Sub Got this message: --------------------------- Microsoft Office Access --------------------------- The value already exists! --------------------------- OK --------------------------- And have to close out saying "Microsoft access may have encountered an error while trying to save a record. If you close this object now the changes you made will be lost. So you want to close the database object anyways?" Chris |
#22
|
|||
|
|||
Unique entry
Sounds like you're trying to close the form after you enter a value but
before you moved the focus from the control. Your very early post said you were tabbing from the control. Are you closing the form using the "red X" instead of tabbing from the control? It will be helpful if you describe the sequence of things that you want to do on this form. -- Ken Snell MS ACCESS MVP "Chris" wrote in message oups.com... I pasted this: Private Sub Symbol_ID_BeforeUpdate(Cancel As Integer) If DCount("*", "Borrowing", _ "[Symbol ID]='" & Nz(Me![Symbol ID].Value, "") & "'") 0 Then MsgBox "The value already exists!" Cancel = True End If End Sub Got this message: --------------------------- Microsoft Office Access --------------------------- The value already exists! --------------------------- OK --------------------------- And have to close out saying "Microsoft access may have encountered an error while trying to save a record. If you close this object now the changes you made will be lost. So you want to close the database object anyways?" Chris |
#23
|
|||
|
|||
Unique entry
If my last symbol keyed is a good one it all works fine, but if the
last symbol I key is a duplicate I am stuck! I key the symbol - hit tab & get this message: --------------------------- Microsoft Office Access --------------------------- The value already exists! --------------------------- OK --------------------------- I hit ok. The symbol I typed is still there. I delete it and then close out because I am done. It is my last entry & it does not want me to exit because it knows I started a new record & did not complete it. Chris |
#24
|
|||
|
|||
Unique entry
See above first.
Possibly this is just the way I will have to exit - & live with it - since it knows this is now an uncompleted form? Chris |
#25
|
|||
|
|||
Unique entry
OK - let's add one step to your code -- the Undo method for the bound
control:. Private Sub Symbol_ID_BeforeUpdate(Cancel As Integer) If DCount("*", "Borrowing", _ "[Symbol ID]='" & Nz(Me![Symbol ID].Value, "") & "'") 0 Then MsgBox "The value already exists!" Cancel = True Me![Symbol ID].Undo End If End Sub That will eliminate the problem of you having to delete the entry that you'd made. Now, if you want to cancel the entry of the new record entirely, then we can add one more step to undo the entire new record: Private Sub Symbol_ID_BeforeUpdate(Cancel As Integer) If DCount("*", "Borrowing", _ "[Symbol ID]='" & Nz(Me![Symbol ID].Value, "") & "'") 0 Then MsgBox "The value already exists!" Cancel = True Me![Symbol ID].Undo Me.Undo End If End Sub -- Ken Snell MS ACCESS MVP "Chris" wrote in message oups.com... If my last symbol keyed is a good one it all works fine, but if the last symbol I key is a duplicate I am stuck! I key the symbol - hit tab & get this message: --------------------------- Microsoft Office Access --------------------------- The value already exists! --------------------------- OK --------------------------- I hit ok. The symbol I typed is still there. I delete it and then close out because I am done. It is my last entry & it does not want me to exit because it knows I started a new record & did not complete it. Chris |
#26
|
|||
|
|||
Unique entry
You are an absolute genius!!! It worked and did exactly what I need it
to!! Thank you so much for your help! Chris Agostino |
#27
|
|||
|
|||
Unique entry
You're welcome... glad it worked ok.
-- Ken Snell MS ACCESS MVP "Chris" wrote in message oups.com... You are an absolute genius!!! It worked and did exactly what I need it to!! Thank you so much for your help! Chris Agostino |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Memo Field | Sam | General Discussion | 12 | November 10th, 2005 09:16 PM |
How do I make a unique entry | Lynn Bales | New Users | 9 | August 15th, 2005 10:55 PM |
How do I create a table of unique records from two or more tables | Rubble | Running & Setting Up Queries | 5 | June 23rd, 2005 12:05 PM |
Query on unique | Steven | Running & Setting Up Queries | 3 | February 5th, 2005 12:24 AM |
decipher log of scanpst.exe | km | General Discussion | 0 | July 18th, 2004 09:00 AM |