Connecting Tech Pros Worldwide Help | Site Map

RecordCount > 4 vb6.0

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 31st, 2008, 06:41 AM
Newbie
 
Join Date: Oct 2008
Posts: 16
Default RecordCount > 4 vb6.0

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
Reply
  #2  
Old December 31st, 2008, 09:34 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,310
Default

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

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

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.