Connecting Tech Pros Worldwide Help | Site Map

RecordCount > 4 vb6.0

Newbie
 
Join Date: Oct 2008
Posts: 23
#1: Dec 31 '08
Hello Friends,
vb6.0
i want to add only 4-record in the table IF record is greater then or equal then 4 then i want to show message and
Main_frm.Login_mnu.Enabled = False

code i use:

Set pk = OpenDatabase(App.Path & "\NewCount.mdb", False, False)
Set r = pk.OpenRecordset("Count", dbOpenDynaset)
If r.RecordCount > 4 Then
Main_frm.Login_mnu.Enabled = False
Else
Main_frm.Login_mnu.Enabled = True
End If

but it is not working
best answer - posted by debasisdas
before inserting new records you need to check for the count of records in the database tables and then proceed further.
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,505
#2: Dec 31 '08

re: RecordCount > 4 vb6.0


what do you mean by add only 4-record in the table


if you are adding records to database tables then why you need to use recordcount property of recordset object ?
Newbie
 
Join Date: Oct 2008
Posts: 23
#3: Jan 1 '09

re: RecordCount > 4 vb6.0


Quote:

Originally Posted by debasisdas View Post

what do you mean by add only 4-record in the table


if you are adding records to database tables then why you need to use recordcount property of recordset object ?

NewCount.mdb => Count (Table) => Record (Field)

i want to add only 4 record in Record field

Dim r As Recordset
Set r = pk.OpenRecordset("Count", dbOpenDynaset)
r.AddNew
r.Fields("Record") = 1
r.Update
r.close
???????????????????????
if Record(field ) row is greater then or equal to 4 then record can't be add
please send relative codes as quick as
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,505
#4: Jan 1 '09

re: RecordCount > 4 vb6.0


before inserting new records you need to check for the count of records in the database tables and then proceed further.
Reply