G
Guest
Hi, can anyone help a recent Access user
I have a text box (txtText) above a list box (txtList) on a form
(frmGetSubDivInfo).
The plan is for the user to enter some text into the text box and when enter
is hit
some code runs (AfterUpdate property).
The code finds the closest match in the underlying table bound to txtList
(tblSubDivIndex). I then want txtList to goto the record found in
tblSubDivIndex
and highlight it on the form. There are several hundred records in
tlbSubDivIndex
so all the records can not be viewed at the same time.
The code snippet I am attempt to use gives me a strange error, the code is
below:
'match found so update list box
Debug.Print "B7- match found for "; intKeyNum; " ,update txtList"
[Forms]![frmGetSubDivInfo]![txtList].Value = _
DLookup("[SubDivLabel]", "tblSubDivisionIndex", _
"[KeyID] = intKeyNum")
This code worked randomly, now it doesn't at all.
No row highlights and I get a strange error. The error I get is:
"You cancelled the previous operation"
If I change the code to :
'match found so update list box
Debug.Print "B7- match found for "; intKeyNum; " ,update txtList"
[Forms]![frmGetSubDivInfo]![txtList].Value = _
DLookup("[SubDivLabel]", "tblSubDivisionIndex", _
"[KeyID] =" & trim(str(intKeyNum)) )
The error goes away but still no highlighted row. What am I missing?
Any help is greatly appreciated.
I have a text box (txtText) above a list box (txtList) on a form
(frmGetSubDivInfo).
The plan is for the user to enter some text into the text box and when enter
is hit
some code runs (AfterUpdate property).
The code finds the closest match in the underlying table bound to txtList
(tblSubDivIndex). I then want txtList to goto the record found in
tblSubDivIndex
and highlight it on the form. There are several hundred records in
tlbSubDivIndex
so all the records can not be viewed at the same time.
The code snippet I am attempt to use gives me a strange error, the code is
below:
'match found so update list box
Debug.Print "B7- match found for "; intKeyNum; " ,update txtList"
[Forms]![frmGetSubDivInfo]![txtList].Value = _
DLookup("[SubDivLabel]", "tblSubDivisionIndex", _
"[KeyID] = intKeyNum")
This code worked randomly, now it doesn't at all.
No row highlights and I get a strange error. The error I get is:
"You cancelled the previous operation"
If I change the code to :
'match found so update list box
Debug.Print "B7- match found for "; intKeyNum; " ,update txtList"
[Forms]![frmGetSubDivInfo]![txtList].Value = _
DLookup("[SubDivLabel]", "tblSubDivisionIndex", _
"[KeyID] =" & trim(str(intKeyNum)) )
The error goes away but still no highlighted row. What am I missing?
Any help is greatly appreciated.