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

Error checking with poor field name

Status
Not open for further replies.

Scoob55k

Technical User
Nov 16, 2005
62
US
I have a database that I took over and I am in the process of improving and installing some error checking code in the "Before Update" sections to provide less missing and more consistent data. Below is the code I am having issues with. The field name is not a good one and to fix it correctly I feel I need to change it, however due to reports, etc. using the field name and time constraints, I was hoping to get a tip on how I can use thie cuttetnt field name. I'm almost certain it's the ? thaty is causing the problem. Thanks!

ElseIf IsNull (Is_this_claim_assigned_to_me?) Or Is_this_claim_assigned_to_me? = 0 Then
MsgBox "Must enter who task is asssigned to.", vbCritical, "Enter claim assignment"
[Is_this_claim_assigned_to_me?].SetFocus
 
Wrap names with spaces/special characters/etc in square brackets...like the last line you sampled.


Code:
ElseIf IsNull ([Is_this_claim_assigned_to_me?]) Or [Is_this_claim_assigned_to_me?] = 0 Then
    MsgBox "Must enter who task is asssigned to.", vbCritical, "Enter claim assignment"
    [Is_this_claim_assigned_to_me?].SetFocus

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Actually, I tried that and that code is actually in there now, I just have it omitted right now. Also, the brackets on the last line will not allow the .SetFocus command to work anyway. Bummer. This is why I almost never have spaces in my field names anymore. Thanks!

Let me know if there is anything else you can think to try.
 
Have you tried placing the Me shortcut in from of the control names???

Me![Is_this_claim_assigned_to_me?].SetFocus



=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
spaces in my field names
Like this ?
ElseIf Nz(Me![Is this claim assigned to me?], 0) = 0 Then
MsgBox "Must enter who task is asssigned to.", vbCritical, "Enter claim assignment"
Cancel = True
Me![Is this claim assigned to me?].SetFocus

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Perfect! Thank you all for your valuable help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top