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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with code

Status
Not open for further replies.

tyant

Programmer
Jun 1, 2001
68
AU
The code is meant to check if there is a value in the text box. If there is no value its meant to display a msgbox.

If the value is not a date or is not "-" then the msgbox should appear.

**********
The Code:*
**********
Case frmInsertCompany.Incorp.value = "" or _
not isDate(frmInsertCompany.Incorp.value)
Ret = False
Msgbox "Incorporated must not be empty, It should be a Date"
frmInsertCompany.Incorp.value = "-"
 
Do you really want something like:
Code:
If frmInsertCompany.Incorp.value = ""  or _
    not IsDate(frmInsertCompany.Incorp.value) Then
  Ret = False
Else
  MsgBox "Incorporated must not be empty, " _
       & "It should be a Date"
  frmInsertCompany.Incorp.value = "-"
End If
Or am I really missing something here?
 
Code:
If Not(frmInsertCompany.Incorp.value = "-"  or _
    IsDate(frmInsertCompany.Incorp.value) Then
    Ret = False
    MsgBox "Incorporated must not be empty, " _
       & "It should be a Date"
    frmInsertCompany.Incorp.value = "-"
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top