Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 694
  • Last Modified:

You entered an expression that has no value.

With CurrentDb.OpenRecordset("ContractDatabase", dbOpenDynaset)
      .FindFirst "ContractNo= '" & Me.Text67 & "'  And Clientname = '" & Me.Text69 & "'  "
If Not .NoMatch Then
     If MsgBox("The Contract already exists, please click on update button to make changes.", vbOKCancel) = vbCancel Then Exit Sub
End If
     !ContractNo = Me.Text67
     !ClientName = Me.Text69
     !ActiveInactive = IIf(Me.Active.Value = True, "yes", "no") <---- I get the error here
     !TotalContractValue = Me.Text75
     !TaskNo = Me.Text77
     !StartYear = Me.Text81
     !EndYear = Me.Text83
     !Name = Me.Text85
     !FinalValue = Me.Text87
     !Description = Me.Text89
     !Location = Me.Combo93
     !Partners = Me.Combo116
     !RCM = IIf(Me.Check102 = True, "yes", "no")
     !RTS = IIf(Me.Check104 = True, "yes", "no")
     !RGS = IIf(Me.Check106 = True, "yes", "no")
     !RGSt = IIf(Me.Check108 = True, "yes", "no") '
     !RCE = IIf(Me.Check110 = True, "yes", "no")
     !RCS= IIf(Me.Check112 = True, "yes", "no")
     !RBM = IIf(Me.Check114 = True, "yes", "no")
End With

Please help.
  • 2
3 Solutions
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
    !ActiveInactive = IIf(Nz(Me.Active, "Wahoooo") = True, "yes", "no") <---- Give this a whirl.  
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
btw you should really rename your controls to something that has meaning of what the control represents, such as txtContractNumber, chkRCM, and txtStartYear, instead of Check102, Text75, and Combo34384532.  This will create less confusion as you code.

This style will differ by developer, of course, but the most commonly used for Access is Leszynski/Reddick

Hope this helps.
What you wrote will only work if all the controls your a providing values to in the form of 'Yes' and 'No' are in fact textboxes.  If they are Option Buttons or Check Boxes then replace:

!ActiveInactive = IIf(Me.Active.Value = True, "yes", "no")


 !ActiveInactive = IIf(Me.Active.Value = True, -1, 0)

Likewise for the rest of the Boolean replacements in your code.

The first thing to check it the data type of .Active to insure it isn't something like a Text field.  As long as it is a numberic field you should be OK but it is best not to check for true (which is actually an alias for -1) since anything not 0 (ie 1, 2, 3, etc) is technically true.  All you really need is to use the IIF statment to evaluate the value, if it's Non-0 it will return true and respond accordinly.  

Just in case it is a Null I've thrown in the Nz() function to make it false it that event.  

If all this fails I'd check the recordset to see if it has a field named "Active".  The absence of such a field would again explain what is happening.

!ActiveInactive = IIf(Nz(Me.Active.Value,0), "yes", "no")

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now