Blank Area of Listbox

J

JamesJ

Hi. I'm using the following code on the OnClick of
a list box.

DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

It opens frmDvdEdit on the DoubleClicked row in the listbox

I only want the DoCmd to run if I double click an occupied row of the
listbox.
If the doubleclick occurs on a blank row I want nothing to happen.
I'm not sure what I should be checking for but nothing seems to be working.
I've tried:

If Me!lstDvd.Value = "" Then

Else
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

End If
 
T

tina

try

If Not IsNull(Me!lstDvd) Then
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd
End If

hth
 
J

JamesJ

Nope. Same thing.


tina said:
try

If Not IsNull(Me!lstDvd) Then
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd
End If

hth


JamesJ said:
Hi. I'm using the following code on the OnClick of
a list box.

DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

It opens frmDvdEdit on the DoubleClicked row in the listbox

I only want the DoCmd to run if I double click an occupied row of the
listbox.
If the doubleclick occurs on a blank row I want nothing to happen.
I'm not sure what I should be checking for but nothing seems to be working.
I've tried:

If Me!lstDvd.Value = "" Then

Else
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

End If
 
T

tina

did you put the VBA code in the Click event procedure, or the DoubleClick
event procedure?

hth


JamesJ said:
Nope. Same thing.


tina said:
try

If Not IsNull(Me!lstDvd) Then
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd
End If

hth


JamesJ said:
Hi. I'm using the following code on the OnClick of
a list box.

DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

It opens frmDvdEdit on the DoubleClicked row in the listbox

I only want the DoCmd to run if I double click an occupied row of the
listbox.
If the doubleclick occurs on a blank row I want nothing to happen.
I'm not sure what I should be checking for but nothing seems to be working.
I've tried:

If Me!lstDvd.Value = "" Then

Else
DoCmd.OpenForm "frmDvdEdit", , , "[DvdMovieID]=" & Me!lstDvd

End If
 

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