Hi i'd like to use a methodology that prevents new data being added to an existing record with the same field data.
ex: if record with mno=9 and bno=4 exists in the table, The system shud prevent any new entry with mno=9 and bno=4..
i used the following dummy code but it doesn't prompt me "yes".
(rs-recordset, mno from listview, bno from variable strBno, strExists-string variable.
strMno-long variable)
1. is it something wrong with my sql?.
2. can u suggest an alternative method to check whether a record exists
All i want to do is,
if it prompts "yes" i dont add the record.
if it propmts "no" i want to add the record.
input really appreciated.
thnx!!!!
Mur.
ex: if record with mno=9 and bno=4 exists in the table, The system shud prevent any new entry with mno=9 and bno=4..
i used the following dummy code but it doesn't prompt me "yes".
(rs-recordset, mno from listview, bno from variable strBno, strExists-string variable.
strMno-long variable)
Code:
private sub cmdCheck_click()
rs7.Open "SELECT count(mno) as TotalMno FROM ModuleDetails md where md.mno=" & lstvModules.SelectedItem & " and md.bno=" & strBno
strMno = rs7.Fields("totalmno")
If strMno > 1 Then
strExists = "yes! Mno + Bno exists" ' already record is there
End If
If strMno < 1 Then
strExists = "No! Mno + Bno doesn't exist" ' no record is there
End If
MsgBox "message:" & strExists
End Sub
1. is it something wrong with my sql?.
2. can u suggest an alternative method to check whether a record exists
All i want to do is,
if it prompts "yes" i dont add the record.
if it propmts "no" i want to add the record.
input really appreciated.
thnx!!!!
Mur.