Open form based on listbox selection

ScrmingWhisprs

I <3 Coffee Milk.
Local time
Today, 18:01
Joined
Jun 29, 2006
Messages
156
I have the following code in the Double-Click event of my listbox:
Code:
DoCmd.OpenForm "frmEditContact", acNormal, , "[ContactID] = " & Me.lboRecent
The form opens, but it is completely blank. It only shows the title bar and close button. The rest is just white. What am I doing wrong? I have the same thing going on another form and it works fine.

ScrmingWhisprs
 
Is the listbox multiselect? What's the data type of ContactID?
 
The listbox is not multi-select. ContactID is an Autonumber.

This is really boggling my mind.
 
Is ContactID the bound column of the listbox?
 
Going white makes me think that it isn't getting any records. Check your code:
Code:
DoCmd.OpenForm "frmEditContact", acNormal, , "[ContactID] = " & Me.lboRecent
It looks like you have a space between the = and Me.lboRecent
Code:
DoCmd.OpenForm "frmEditContact", acNormal, , "[ContactID] =" & Me.lboRecent
 
Bob, I always include a space after the =, without problems.
 
Well, technically it would see it as a space and then the combo value. I'm not sure why it works for you Paul, but it really shouldn't. I would have them try without the space to see if it fixes it, and if not, we'll go somewhere else.
 
Bet you a bottle of Portland's finest! That technique works on all 3 of my development computers, with both A2k and A2003, and on a large number of user PC's running the various applications created on those computers.
 
Try:

Code:
DoCmd.OpenForm "frmEditContact", acNormal, , "[ContactID] = " & Me.lboRecent.Column(0)
 
If frmEditContact is not set as data entry or the filter is not disabled, why you are not trying to display the Filter content in a message box by using [] to see what you have passed to frmEditContact and what is in the Me.lboRecent ant the passing time.
 
YAY!!!!! This worked:
Code:
DoCmd.OpenForm "frmEditContact", acNormal, , "[ContactID] = " & Me.lboRecent.Column(0)
I love you guys!
 

Users who are viewing this thread

Back
Top Bottom