Full Version: Runtime error 3079 - explanation please
UtterAccess Forums > Microsoft® Access > Access Forms
cielo
The text of the error pop-up:
The search key was not found for any record"
When I open a form and immediately click the 'last record' button I get the above error. The debugger takes me to this piece of code.
'Alerts if there if there is a date discrepancy between age and service attended.
If (Forms!frmPeople!txtAge > 14) And (Me.cmbServiceTitle.Column(1) = "Sunday School") _
FOr (Forms!frmPeople!txtAge > 30) And (Me.cmbServiceTitle.Column(1) = "Young Adults") _
Or (Forms!frmPeople!txtAge > 19) And (Me.cmbServiceTitle.Column(1) = "Youth church") Then
Me.lblServiceError.Visible = True
Else
Me.lblServiceError.Visible = False
It sits in the on current event of the subform to frmPeople.
Can ayone tell me what is wrong.
TIA
Alan
adaytay
Hi Alan,
The logic is wrong for the logical comparison - it's comparing every statement rather than each pair.
Try this instead:
If ((Forms!frmPeople!txtAge > 14) And (Me.cmbServiceTitle.Column(1) = "Sunday School")) _
FOr ((Forms!frmPeople!txtAge > 30) And (Me.cmbServiceTitle.Column(1) = "Young Adults")) _
Or ((Forms!frmPeople!txtAge > 19) And (Me.cmbServiceTitle.Column(1) = "Youth church")) Then
HTH,
Ad
cielo
Hey! It's you again...thanks I'll get right onto it.
lan
adaytay
I keep cropping up everywhere these days!! (Not sure if that's a good thing or not laugh.gif) Is your recent issue still causing problems ("Rev A"), or did you manage to get that sorted out?

Ad
cielo
Hmmmm, you logic seems a bit off too wink.gif. The formula is fine but the error still comes up if I jump from first to last record immediately after opening the form.
xtAge is based on fldDOB - fldDate(), often fldDOB will be left blank as is now in many records. Could this be the cause. I tried putting an if clause for fldDOB = null or "" but it did not change things.
Any other suggestions.
HAs for the visibility issue. I have reverted back to my original until I can figure the first bit that sets all to true.
Thanks for replies.
Alan
PS My son is in Redhill, Berkshire working at the mo' and loving it.
adaytay
Try this:
pre> [color="#00007F"]If [color="#00007F"]Not IsNull(txtAge) [color="#00007F"]Or Len(txtAge) > 0 [color="#00007F"]Then
[color="#007F00"]'Alerts if there if there is a date discrepancy between age and service attended.
[color="#00007F"]If ((Forms!frmPeople!txtAge > 14) And (Me.cmbServiceTitle.Column(1) = "Sunday School")) _
[color="#00007F"]Or ((Forms!frmPeople!txtAge > 30) And (Me.cmbServiceTitle.Column(1) = "Young Adults")) _
[color="#00007F"]Or ((Forms!frmPeople!txtAge > 19) And (Me.cmbServiceTitle.Column(1) = "Youth church")) [color="#00007F"]Then
Me.lblServiceError.Visible = [color="#00007F"]True
[color="#00007F"]Else
Me.lblServiceError.Visible = [color="#00007F"]False
[color="#00007F"]End [color="#00007F"]If
[color="#00007F"]Else
Me.lblServiceError.Visible = [color="#00007F"]False
[color="#00007F"]End [color="#00007F"]If

Berkshire... hmmm... I've been to Reading. That's about it! laugh.gif
Ad
cielo
Works a treat thanks very much.
lan
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.