First line is wrong ... Any help would be appreciated
If [CACorIDcard] = -1 And [IDResaon] = "Lost" Then
DoCmd.OpenForm "frmCE_LostCAC"
Else
End If
First line is wrong ... Any help would be appreciated
If [CACorIDcard] = -1 And [IDResaon] = "Lost" Then
DoCmd.OpenForm "frmCE_LostCAC"
Else
End If
What does "wrong" mean - error message, wrong result, nothing happens?
Is IDResaon a number type field?
Should "IDResaon" be spelled "IDReason"?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
If [CACorIDcard] = -1 And [IDResaon] = "Lost" Then
Are [CACorIDcard] and [IDReason] control names on your form? If so, you need to prefix those with Me! (points to the form you're running your code from).
If Me!CACorIDcard=-1 And Me!IDreason = "Lost" Then
DoCmd.OpenForm "frmSomeForm"
ELSE
msgbox "Sorry!",vbokonly
End If
Still not happening (form doesn't appear).
IDReason is a text field
CACorIDCard is a Yes/No field
If I use one field, it works. I believe the problem has something to do with how the fields are connected. Is "And" correct?
Can you post just this form and the tables it needs? then we can see what's wrong.
I couldn't attached the file (too big), even after deleting all the other forms, queries, reports, etc.
I attached a screenshot.
That would lead me to believe the code is working, just that you do not have the combination to open your form. Walk your code line by line with breakpoints and inspect your values. Don't just assume they are correct.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
You would need to show the record where those controls are correct, not design view.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
The code is run (After update in the IDReason)
The break points suggestion was the key. The IDReason is a linked table. I was referring to the field in the table.
THANK YOU