Connecting Tech Pros Worldwide Forums | Help | Site Map

Form for add new category

Newbie
 
Join Date: Oct 2009
Posts: 15
#1: 4 Weeks Ago
hi,
I have developed a form for add new category using Ms-Access 2003 the first problem for me I got the error 3022 for no duplicating values and i have solved this one using this code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CategoryName_BeforeUpdate(Cancel As Integer)
  2.  
  3.  Dim Answer As Variant
  4.  Answer = DLookup("[CategoryName]", "tbl_Category", "[CategoryName] = '" & Me.CategoryName & "'")
  5.  If Not IsNull(Answer) Then
  6.  MsgBox "Hi-Tech sysadmin reports that Duplicate Category Name Found, " & "Please press ok and try again. ", vbCritical + vbOKOnly + vbDefaultButton1, "Hi-Tech sysadmin, Duplicate Category Found"
  7.  Cancel = True
  8.  Me.CategoryName.Undo
  9.  End If
  10. End Sub
but after I used this i found that I can get record with its ID number but the category name is null
so I set the categoryname field to null
I got the same error of no duplicating when I use save plus the error of null valued how can make this form for adding new category integrated
it is now 12 days to trap this error
so if anyone could provide any help for solving this please submit
thank you in advance for any help you may provide me

Delerna's Avatar
Expert
 
Join Date: Jan 2008
Location: Sydney
Posts: 790
#2: 4 Weeks Ago

re: Form for add new category


3022 error + null value error


Identical question in 2 forums
Some possible answers are posted in the other post.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#3: 4 Weeks Ago

re: Form for add new category


Delerna is quite correct but I can understand why you may have done it that way. In future a better approach would be to post the question in one forum, then simply post a link to that question in the other forum. That way all answers are kept together.

I'm locking this thread now so any interested parties can offer help in the other thread.

Welcome to Bytes!
Closed Thread