SnaveBelac
Programmer
I have been using a prticular function on a form to show or hide subforms based on data on the form.
This particular function has been working perfectly for months !
I was just adding a button to lock all the controls on a form to prevnet non administrators from editing the content and BAM - my other (apparently) unrelated function goed belly up woth the error - "You entered an expression that has no value"
At first I thought it was trying to access the AddressID prior to the form completely loading, hence the Do-Loop
This has got me completely stumped - Any help would be very much aappreciated...code is below:
Thanks in advance
----------------------------
SnaveBelac - Adventurer
----------------------------
This particular function has been working perfectly for months !
I was just adding a button to lock all the controls on a form to prevnet non administrators from editing the content and BAM - my other (apparently) unrelated function goed belly up woth the error - "You entered an expression that has no value"
At first I thought it was trying to access the AddressID prior to the form completely loading, hence the Do-Loop
This has got me completely stumped - Any help would be very much aappreciated...code is below:
Code:
Private Sub Form_Current()
Dim varExist As Variant
Do
Loop Until Application.SysCmd(acSysCmdGetObjectState, acForm, Me.Name) = acObjStateOpen
[b]***ERROR OCCURS ON THIS LINE***[/b]
If Not IsNull(Me!AddressID.Value) And Me!AddressID.Value <> "" Then
[b]***ERROR OCCURS ON THIS LINE***[/b]
varExist = DLookup("RateDetailID", "tbl_RateDetail", "RD_BillID=" & Me!AddressID)
If IsNull(varExist) Then
Me!lblNoRates.Visible = True
Me!sub_RateDetail.Visible = False
Else
Me!lblNoRates.Visible = False
Me!sub_RateDetail.Visible = True
End If
varExist = DLookup("JobID", "tbl_Job", "J_SiteID=" & Me!AddressID)
If IsNull(varExist) Then
Me!lblNoSite.Visible = True
Me!sub_JobSite.Visible = False
Else
Me!lblNoSite.Visible = False
Me!sub_JobSite.Visible = True
End If
varExist = DLookup("E_EquipmentID", "tbl_Equipment", "E_AddressID=" & Me!AddressID)
If IsNull(varExist) Then
Me!lblNoEquipment.Visible = True
Me!sub_Equipment.Visible = False
Else
Me!lblNoEquipment.Visible = False
Me!sub_Equipment.Visible = True
End If
varExist = DLookup("JobID", "tbl_Job", "J_BillID=" & Me!AddressID)
If IsNull(varExist) Then
Me!lblNoBill.Visible = True
Me!sub_JobBill.Visible = False
Else
Me!lblNoBill.Visible = False
Me!sub_JobBill.Visible = True
End If
End If
End Sub
Thanks in advance
----------------------------
SnaveBelac - Adventurer
----------------------------