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!

Getting some code to work

Status
Not open for further replies.

cer5yc

Programmer
Sep 27, 2007
103
US
I need the following line of code to work - currently it's not doing anything

Here's what I have:

If Me.opgProjectStatus = 2 and Me.txtContractStatus.Value <> "E-copy to LOB" Then
Dim MsgBox6 As Integer
MsgBox6 = Msg("You cannot close a contract unless 'E-copy to LOB' is selected", vbOkayOnly)
End If
Exit Sub

txtContractStatus is a combo box and one of the drop-down options is 'E-copy to LOB'

Can someone please tell me what I am doing wrong. Thanks!
 
What are you trying to get it to do, just display a message box if the requirements are met?

In that case you don't need to Dim you MsgBox, and especially not as an Int.

Just output straight to the MsgBox

Code:
MsgBox("You cannot close a contract unless 'E-copy to LOB' is selected", vbOkayOnly)
 
I have tried and tried to get the code to work with doing the Dim MsgBox As Integer (I know it's silly). But I keep getting a code error. When I type the following line it turns red and tells me syntax error and for the love of me I can't figure our why

MsgBox("You cannot close a contract unless 'E-copy to LOB' is selected", vbOkayOnly)

 
I keep getting an error that says Compile Error Expected: =
 
Fixed the MsgBox problem - back to my original problem

If Me.opgProjectStatus = 2 And Me.txtContractStatus <> "E-copy to LOB" Then

This is the line that isn't working - specifically the <>

If I replace <> with = it works just fine, but that's not what I need
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top