Connecting Tech Pros Worldwide Help | Site Map

RecordCount > 4 vb6.0

  #1  
Old December 31st, 2008, 07:41 AM
Newbie
 
Join Date: Oct 2008
Posts: 23
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
  #2  
Old December 31st, 2008, 10:34 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,485
Provided Answers: 1

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 ?
  #3  
Old January 1st, 2009, 04:47 AM
Newbie
 
Join Date: Oct 2008
Posts: 23

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
  #4  
Old January 1st, 2009, 04:09 PM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,485
Provided Answers: 1

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