By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

Field not updating...

P: 83
I have attached a small database. In the "sFrmIncrements" there is a field named "newIncrement" I am trying to update the field but is not working. I don't know why.

Expand|Select|Wrap|Line Numbers
  1. IIf(LookUp("incrementOf","tblPFST","tblPFST.serviceOf='" & [serviceType] & "' And tblPFST.rankOf='" & [rank] & "'")>[increment],[increment]+1,"N/A")
is the data source for the field.

If I try it in the intermediate window it is working.

? IIf(LookUp("incrementOf","tblPFST","tblPFST.servic eOf='1' And tblPFST.rankOf='CAPT'")>2,3+1,"N/A") is giving 3

? IIf(LookUp("incrementOf","tblPFST","tblPFST.servic eOf='1' And tblPFST.rankOf='CAPT'")>5,5+1,"N/A") is giving "N/A"

What could I be doing incorrectly?


Raghu Prabhu
Attached Files
File Type: zip (73.2 KB, 62 views)
May 21 '12 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 634

From you description abd DB shouldn't the Control Source be
Expand|Select|Wrap|Line Numbers
  1. =[increment]+1

To use the DLookup() you would need to refer to the controls on the form any way (which you don't) but as you have the current increment value in the form why not just add one?

Using either method would not actually increment the table data as it stands. Udating the table with this form would need a bit of code, usually in the form Open/Load or Unload/Close events, depending on when the update is required etc.


May 21 '12 #2

Expert Mod 15k+
P: 31,494
Where is LookUp() defined? I only have DLookup() available in my system ;-)
May 21 '12 #3

Expert Mod 10K+
P: 12,366
If by data source you mean control source, then of course it won't update. It is no longer linked to a field in the table. You need to bind the control source to the field and do the update in an event.
May 21 '12 #4

P: 83
Sorted it by way of 500 lines of code instead of one line
Attached Files
File Type: zip (45.0 KB, 43 views)
May 22 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.