Link to home
Start Free TrialLog in
Avatar of thenelson
thenelson

asked on

VBA Line causes Access to hang up.

The following line causes Access 2003 to hang up:
       Me.ComplaintID.Text = strFilter
ComplaintID is  a combobox, strFilter contains any string.
When the code reaches that line, Access just hangs, no error message. I have to go into task manager to close Access down.
 I precede that line with:
        Me.ComplaintID.SetFocus
I have tried other forms of the line such as:
        Forms.frmPt.ComplaintID.Text = strFilter
        frmPt!ComplaintID.Text = strFilter
        ComplaintID.Text = strFilter
 with the same result.
 I have used
         Me.ComplaintID.Text =
 in other areas of the object module without problem.
 Any ideas what is going on?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenelson
thenelson

ASKER

The control source of ComplaintID is a long referencing the key field of a linked table. By entering the text property of ComplaintID, I am trying to fire the not in list event of ComplaintID which creates a new record in the linked table and then requeries ComplaintID with Response = acDataErrAdded.

strFilter contains any string. I have tried several different strings from a zero length string to a string of the maximum length of the displayed field for ComplaintID.

I do have:
Me.ComplaintID.SetFocus
Me.ComplaintID.Text = strFilter
I found where the problem is.  I have a do loop in the not in list event of ComplaintID that is not completing. By explaining what is happening to all of you, I realized I needed to step through the code. So now I need to fit the do loop. Thanks to all who responded.