Listbox to open record in another form frustration

T

Todd

I'm about to go crazy here. I have records showing in a listbox
(lstShortGoals). I set the double click event to...

Dim Crit As String
Crit = "[GoalID] = " & Me.lstShortGoals
DoCmd.OpenForm "GoalDetails", , , Crit

The code opens the form, but it displays a blank record (new actually), not
the one specified. I've looked at the code as it runs and Me.lstShortGoals
is set to the correct GoalID number. This is boggeling my mind. What could
I be doing wrong? Could it be my form properties?

Thanks!
 
M

Minton M

I'm about to go crazy here. I have records showing in a listbox
(lstShortGoals). I set the double click event to...

Dim Crit As String
Crit = "[GoalID] = " & Me.lstShortGoals
DoCmd.OpenForm "GoalDetails", , , Crit

The code opens the form, but it displays a blank record (new actually), not
the one specified. I've looked at the code as it runs and Me.lstShortGoals
is set to the correct GoalID number. This is boggeling my mind. What could
I be doing wrong? Could it be my form properties?

Thanks!

Check that the form you're opening doesn't have its DataEntry property
set to TRUE, since this will open in the way you describe. If it's not
that, chances are there's some other property screwing it up. Does the
form function as expected if you open it manually?

-- James
 
B

Beetle

Is GoalID the bound column of your list box? If not you'll have to use

Dim Crit As String
Crit = "[GoalID] = " & Me.lstShortGoals.Column(x)
DoCmd.OpenForm "GoalDetails", , , Crit

where x is the column number of GoalID. It's zero based so the first column
is Column(0), second is Column(1), etc.

HTH

--
_________

Sean Bailey


Minton M said:
I'm about to go crazy here. I have records showing in a listbox
(lstShortGoals). I set the double click event to...

Dim Crit As String
Crit = "[GoalID] = " & Me.lstShortGoals
DoCmd.OpenForm "GoalDetails", , , Crit

The code opens the form, but it displays a blank record (new actually), not
the one specified. I've looked at the code as it runs and Me.lstShortGoals
is set to the correct GoalID number. This is boggeling my mind. What could
I be doing wrong? Could it be my form properties?

Thanks!

Check that the form you're opening doesn't have its DataEntry property
set to TRUE, since this will open in the way you describe. If it's not
that, chances are there's some other property screwing it up. Does the
form function as expected if you open it manually?

-- James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top