A
ABL
I have a strange problem, and I'm starting to draw blood from beating my
head against the wall.
Basically, I have a table with both an autonumber field, customer_id,
(used for links to other tables) which is transparent to the user, and a
user id field, cnum, which the user may or may not change.
Cust_num is automatically generated at record creation. I count through
the records and find the first unused number:
custnum = 0
Do
custnum = custnum + 1
Loop Until DCount("*", "customer", "[cnum] = " & custnum) = 0
Perhaps, not the most elegant, but it gets the job done in another form,
I'm using.
Basically, the user enters a new customer name (they can also select an
existing one, but that functionality works okay) and cnum is generated.
I am not using a bound field, so I set Me!cust_num = custnum, after
record creation, before I leave my customername_NotInList sub. After
some other assignments, I have:
Me!cust_num.setfocus
So far, so good.
I have set Debug.Print points at the end of NotInList, and created subs
for cust_num SetFocus, GotFocus, BeforeUpdate and AfterUpdate. So the
order of items and the characteristics are:
cust_num.GotFocus (correct answer)
NotInList (correct answer)
Cust_num.beforeupdate (WRONG answer = customer_id)
cust_num.LostFocus (WRONG answer = customer_id)
I have this SAME code in a different form, and it works. Maybe I was
just lucky with the other form, but I'm lost for a solution.
Has anyone seen anything like this? What am I not telling you that
might help?
I am using Windows XP and Access 2K SP3 (MS VB 6.3). A push in the right
direction would be appreciated.
Thanks,
Alden
PLEASE do NOT reply to this, but post to the newsgroup. Inbound email
is not checked.
head against the wall.
Basically, I have a table with both an autonumber field, customer_id,
(used for links to other tables) which is transparent to the user, and a
user id field, cnum, which the user may or may not change.
Cust_num is automatically generated at record creation. I count through
the records and find the first unused number:
custnum = 0
Do
custnum = custnum + 1
Loop Until DCount("*", "customer", "[cnum] = " & custnum) = 0
Perhaps, not the most elegant, but it gets the job done in another form,
I'm using.
Basically, the user enters a new customer name (they can also select an
existing one, but that functionality works okay) and cnum is generated.
I am not using a bound field, so I set Me!cust_num = custnum, after
record creation, before I leave my customername_NotInList sub. After
some other assignments, I have:
Me!cust_num.setfocus
So far, so good.
I have set Debug.Print points at the end of NotInList, and created subs
for cust_num SetFocus, GotFocus, BeforeUpdate and AfterUpdate. So the
order of items and the characteristics are:
cust_num.GotFocus (correct answer)
NotInList (correct answer)
Cust_num.beforeupdate (WRONG answer = customer_id)
cust_num.LostFocus (WRONG answer = customer_id)
I have this SAME code in a different form, and it works. Maybe I was
just lucky with the other form, but I'm lost for a solution.
Has anyone seen anything like this? What am I not telling you that
might help?
I am using Windows XP and Access 2K SP3 (MS VB 6.3). A push in the right
direction would be appreciated.
Thanks,
Alden
PLEASE do NOT reply to this, but post to the newsgroup. Inbound email
is not checked.