Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what if scenario need help!!!

Status
Not open for further replies.

imacamelshump

Technical User
Sep 18, 2003
8
GB
Hey guys need you help, The following is what i got
txtbox - Project_Code
txtbox - Status

Status = Active, Complet, Finished, Under_Development

This is the scenario i need to code for on update for the status text box so that if status is Active, Complete or finished then there MUST be a project code and if status is Underdevelopment that there cant be a project code, and it cant let you leave the record until it is correct,

ive tried and tried to code it but im getting know where can anybody please help me,

any help is grately appreciated
 
Hi I think you need something like this in the on update event procedure

if TxtStatus = ("Active" or "Complete" or "Finished") then

if len(Txtproject)<1 then
msgbox &quot;Project Code Required&quot;
cancel = true
end if

elseif len(TxtProject)>0 then
msgbox &quot;No Project code required&quot;
cancel = true
end if
 
Hi,

Try this...
Code:
    Select Case TxtStatus
        Case &quot;Active&quot;, &quot;Complete&quot;, &quot;Finished&quot;
    
            Select Case Len(TxtProject)
                Case Is < 1
                    MsgBox &quot;Project Code Required&quot;
                    cancel = True
                Case Is > 0
                    MsgBox &quot;No Project code required&quot;
                    cancel = True
            End Select
    End Select
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
hey guys thanks for the code,

when i go to compile its giving me a compile error with cancel = True!!!!!!
 
Hi imacamelshump,

What application are you in and where are you putting the code?

I'm guessing it's Access .. and you should have the code in the Form's BeforeUpdate event.

Enjoy,
Tony
 
yeah, i was putting it in the after update one, but i will try it in before update and see what happens, thnx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top