Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 19th, 2003, 10:52 AM
bogglebeats bogglebeats is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 21 bogglebeats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 47 sec
Reputation Power: 0
comparing a value on a form with a value on a subform

i believe the logic is right. when i hardcode val2 it works fine. i just need to know how to find out the number of records in the form so i can compare that value with another value on another form. the recordcount property is saying "object variable or with block variable not set" i have no idea why it is saying this. please help!


Private Sub New_Communication_Yes_Click()
On Error GoTo Err_New_Communication_Yes_Click
Dim val1 As String, val2 As String
Dim commsession As Recordset

val1 = Form_Prospects.Restrictions.Value

val2 = commsession.RecordCount

If (val1 <= val2) Then
MsgBox "Restricted"
Else
DoCmd.GoToRecord , , acNewRec
Communication_Number.Value = CurrentRecord
Communication_Date.Value = Format(Now, "mm dd yy")
End If
Exit_New_Communication_Yes_Click:
Exit Sub

Err_New_Communication_Yes_Click:
MsgBox Err.Description
Resume Exit_New_Communication_Yes_Click

End Sub

Reply With Quote
  #2  
Old March 12th, 2003, 03:12 PM
jbo jbo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 jbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

It's a little bit too late to answer but... for curious people.

It looks like a VBA Access function. As the error message told you, the variable [commsession] must be set before being used to access object's properties.
I suppose that you want to reference the recordset under a form called [Form_Prospects].
So, yous must add a new code line between val1 and val2 affectations:

Dim commsession As Recordset

val1 = Form_Prospects.Restrictions.Value
set commsession = Form_Prospects.Recordset
val2 = commsession.RecordCount

see you

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > comparing a value on a form with a value on a subform


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT