|
-
Jun 29th, 1999, 09:43 PM
#1
Thread Starter
New Member
i am using unbound dbgrid to allow user to add, edit or delete any data about the purchase order details.
the problem is the item ID entered should not be duplicated since it is a unique key in the database.
i got problem when trying to write the code to check the row entries in the Item ID column each time the user enter that data.
can someone help ?
thanks
-
Jun 30th, 1999, 12:01 AM
#2
New Member
In the Before Column Update Event run a SQL statement to applies only to the column in question. Check to see if entered value alrady exists in the table and clear the entered value and send a message box to notify the user.
ie:
Private Sub grdYourGridName_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)
'The Column # for ID is 1
Select Case ColIndex
Case = 1
Set Recordset = "Select ID from TableName
Where ID = grdYourGridName.col(1).Text
If Not Recordset.BOF and Not Recordset.EOF Then
Cancel = True
msgbox "Duplicate ID Number Entered"
End If
Hope this helps
David Ridgway
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|