Normal Topic How to count records.... (Read 964 times)
camel
Member
*
Offline


Live Long And Prosper

Posts: 2
Joined: May 28th, 2005
How to count records....
May 28th, 2005 at 2:47pm
Print Post Print Post  
Hi All,

I am a Sesame newbie, and developing my first database.

I have an existing database that I wish to find a way to count the amount of existing records (even after updating) and use that number as a variable as part of a For-Next loop to fill a combo box on my new form with data from a valid field in the existing database.

Any ideas??
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: How to count records....
Reply #1 - May 28th, 2005 at 4:29pm
Print Post Print Post  
Hi camel

What you want is @FormResultSetTotal function.

See pages 173-174 in Sesame Programming Guide.  Has an example in a loop.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
camel
Member
*
Offline


Live Long And Prosper

Posts: 2
Joined: May 28th, 2005
Re: How to count records....
Reply #2 - May 29th, 2005 at 4:11pm
Print Post Print Post  
Thank You Bob_Hansen,

I tried your suggestion, but I am not getting the desired outcome.

What am I doing wrong if
1:  have a number field called TotCust
2:  entered code TotCust = @FormResultSetTotal("Customer"), On Form Entry
3:  getting a result of -1
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: How to count records....
Reply #3 - May 29th, 2005 at 9:17pm
Print Post Print Post  
@FormResultSetTotal provides the number of records retrieved from a Search.  See example on page 75 of Sesame Programming Guide.

It is impossible to help you now until you show the code you are using vs. explaining what you are doing. 

Also, where is the code triggered, which field, on entry/exit, etc.?



  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: How to count records....
Reply #4 - May 31st, 2005 at 12:21pm
Print Post Print Post  
Camel,

You may be getting a -1 returned if the form is open in BOTH Add and Update modes.

See the following thread for reference.
http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: How to count records....
Reply #5 - May 31st, 2005 at 8:27pm
Print Post Print Post  
Aaaargh, you are probably right Carl.  Good suggestion. Smiley

You remembered that because it actually happened to you.  The best type of teacher.

I totally forgot about it until you brought it up again and caused me to GROAN!   Embarrassed
Let's see what camel says.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged