Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / March 2006

Tip: Looking for answers? Try searching our database.

update a yes/no field using if then statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jburris@estimating.org - 13 Mar 2006 07:06 GMT
I am completely new to VBA.  I am trying to update a yes/no box in a
subform based on a value that I call from the main form into the
subform.  Below is the if /then statement i am using:

If (Me.[BalanceDue] = 0) Then
Me.[PaidInFull] = -1
End If

The called field is [BalanceDue] and the yes/no field is [PaidInFull]

Can someone tell me if my code is correct and secondly, in which Event
occurance should I put the code.  I have tried it in the AfterUpdate
and OnChange Events of the "called field" and nothing is working.

I don't think I need an "Else" statement here because the default value
for the yes/no is No.  The vast majority of the time our customers are
either paid in full or have paid nothing.  In the event that partial
payment has been made, I want the data entry person will go in and
manually trigger if the partial payment covers the cost of a particular
course (product item).

I don't know if this is important but, the called field is called from
the main form.   But this field in the main form is called from a
second subform where it is calculated.  (I couldn't figure out how to
call the field directly from one subform to another subform)
*******
To answer the eventual question as to why I need to store what looks
like redundant information, my company sells courses and a customer may
purchase multiple courses each with different start dates.  We allow
them to make partial payments up to the start date of a course and I
need to show which courses has been paid for in full even if their
total balance isn't paid off.

Thanks for helping.
BillCo - 13 Mar 2006 11:22 GMT
you need to address the field as an object in the subform.
ie. to address it fully:

Forms![ParentFormName]![SubFormName]![FieldName].Value = -1

then, because the subform is not in focus, you will need to refresh it:

[SubFormName].Requery
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.