Vb Run-Time Error 2105

J

JamesJ

Driving me nuts. I filter records on several of my forms by selecting a
value
in a combo box that is based on a record type tables. For instance, I select
"Drama" from a cbo to view only drama in my movie library. What's happening
is that when I select a value that has no records assigned top it I get The
following
error: "Visual Basic Run-Time Error '2105': You can't got the specified
record"
After I click 'End' the 2 controls I have on the form disappear?! This
occurs only
with one of my forms. I deliberately added a record type to all others table
to try to
reproduce the error but it doesn't happen. It simply displays no records,
which is fine,
Any help will be appreciated.

James
 
K

Ken Snell [MVP]

What is the code that runs in the AfterUpdate event of the combo box that
you use to filter the form?
 
J

JamesJ

Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are different.
It doesn't
cause an error in the others.
 
K

Ken Snell [MVP]

I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to suggest
that you test the Me.RecordsetClone.RecordCount property to ensure that it's
not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to specific
record" occurs? When you get the error, click "Debug" and then see which
line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


JamesJ said:
Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

Ken Snell said:
What is the code that runs in the AfterUpdate event of the combo box that
you use to filter the form?
 
J

JamesJ

Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

Ken Snell said:
I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to suggest
that you test the Me.RecordsetClone.RecordCount property to ensure that
it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to specific
record" occurs? When you get the error, click "Debug" and then see which
line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


JamesJ said:
Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

Ken Snell said:
What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by selecting a
value
in a combo box that is based on a record type tables. For instance, I
select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I get
The following
error: "Visual Basic Run-Time Error '2105': You can't got the specified
record"
After I click 'End' the 2 controls I have on the form disappear?! This
occurs only
with one of my forms. I deliberately added a record type to all others
table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

James
 
K

Ken Snell [MVP]

OK. Let's try this modification to see if it eliminates the problem. (Code
will test for number of records in the new Row Source)

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If DCount("*", lstDvd.RowSource) > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If


JamesJ said:
Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

Ken Snell said:
I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to
suggest that you test the Me.RecordsetClone.RecordCount property to ensure
that it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to specific
record" occurs? When you get the error, click "Debug" and then see which
line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


JamesJ said:
Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by selecting
a value
in a combo box that is based on a record type tables. For instance, I
select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I
get The following
error: "Visual Basic Run-Time Error '2105': You can't got the
specified record"
After I click 'End' the 2 controls I have on the form disappear?! This
occurs only
with one of my forms. I deliberately added a record type to all others
table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

James
 
J

JamesJ

Now I'm getting Run-Time error 3078. (Can't find input table or query....)


James

Ken Snell said:
OK. Let's try this modification to see if it eliminates the problem. (Code
will test for number of records in the new Row Source)

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If DCount("*", lstDvd.RowSource) > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If


JamesJ said:
Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

Ken Snell said:
I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to
suggest that you test the Me.RecordsetClone.RecordCount property to
ensure that it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to
specific record" occurs? When you get the error, click "Debug" and then
see which line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by selecting
a value
in a combo box that is based on a record type tables. For instance, I
select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I
get The following
error: "Visual Basic Run-Time Error '2105': You can't got the
specified record"
After I click 'End' the 2 controls I have on the form disappear?!
This occurs only
with one of my forms. I deliberately added a record type to all
others table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

James
 
K

Ken Snell [MVP]

OK - slight change:

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If Me!lstDvd.ListCount > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If

--

Ken Snell
<MS ACCESS MVP>

JamesJ said:
Now I'm getting Run-Time error 3078. (Can't find input table or query....)


James

Ken Snell said:
OK. Let's try this modification to see if it eliminates the problem.
(Code will test for number of records in the new Row Source)

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If DCount("*", lstDvd.RowSource) > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If


JamesJ said:
Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to
suggest that you test the Me.RecordsetClone.RecordCount property to
ensure that it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to
specific record" occurs? When you get the error, click "Debug" and then
see which line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by
selecting a value
in a combo box that is based on a record type tables. For instance,
I select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I
get The following
error: "Visual Basic Run-Time Error '2105': You can't got the
specified record"
After I click 'End' the 2 controls I have on the form disappear?!
This occurs only
with one of my forms. I deliberately added a record type to all
others table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

James
 
J

JamesJ

It appeared to be a corrupt form.
I renamed the 'bad' form copied and pasted the code
and it seems to work fine now.

Thanks,
James

Ken Snell said:
OK. Let's try this modification to see if it eliminates the problem. (Code
will test for number of records in the new Row Source)

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If DCount("*", lstDvd.RowSource) > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If


JamesJ said:
Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

Ken Snell said:
I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to
suggest that you test the Me.RecordsetClone.RecordCount property to
ensure that it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to
specific record" occurs? When you get the error, click "Debug" and then
see which line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by selecting
a value
in a combo box that is based on a record type tables. For instance, I
select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I
get The following
error: "Visual Basic Run-Time Error '2105': You can't got the
specified record"
After I click 'End' the 2 controls I have on the form disappear?!
This occurs only
with one of my forms. I deliberately added a record type to all
others table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

James
 
K

Ken Snell [MVP]

OK - we likely would have gotten to that option at some point.
Good luck.
--

Ken Snell
<MS ACCESS MVP>

JamesJ said:
It appeared to be a corrupt form.
I renamed the 'bad' form copied and pasted the code
and it seems to work fine now.

Thanks,
James

Ken Snell said:
OK. Let's try this modification to see if it eliminates the problem.
(Code will test for number of records in the new Row Source)

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
If DCount("*", lstDvd.RowSource) > 0 Then
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True
Else
MsgBox "No records"
End If


JamesJ said:
Sorry for the delay. Had to sleep.

The code is stopping (highlighting) Me!lstDvd.SetFocus
below the strSql =...

James

I was expecting to see something in this code that would be "moving" the
form to a specific record. But I don't see anything. I was going to
suggest that you test the Me.RecordsetClone.RecordCount property to
ensure that it's not a zero value before doing the move.

So, can you tell us on which line of code the error "can't go to
specific record" occurs? When you get the error, click "Debug" and then
see which line is yellow-highlighted.

--

Ken Snell
<MS ACCESS MVP>


Dim strAll As String
Dim strSql As String

If Me.cboDvdFilter.Column(1) = "<<All Movies>>" Then

strAll = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd ORDER BY DvdMovieTypeID,
DvdMovieTitle;"
Me!lstDvd.RowSource = strAll
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

Else

strSql = "SELECT DvdMovieID, DvdMovieTypeID, DvdMovieTitle,
DvdShortList, DvdSynopsis FROM tblDvd WHERE (((DvdMovieTypeID)=" &
[cboDvdFilter].[Value] & "))ORDER BY DvdMovieTypeID, DvdMovieTitle;"
Me!lstDvd.RowSource = strSql
Me!lstDvd.Requery
Me.RecordSource = lstDvd.RowSource
Me!cboDvdFilter.SetFocus 'this line seems to have eliminated the
disappearing cbo value problem
Me!lstDvd.SetFocus
Me!lstDvd.Selected(0) = True

End If

This is the same code I use for other forms except the names are
different. It doesn't
cause an error in the others.

What is the code that runs in the AfterUpdate event of the combo box
that you use to filter the form?

--

Ken Snell
<MS ACCESS MVP>

Driving me nuts. I filter records on several of my forms by
selecting a value
in a combo box that is based on a record type tables. For instance,
I select
"Drama" from a cbo to view only drama in my movie library. What's
happening
is that when I select a value that has no records assigned top it I
get The following
error: "Visual Basic Run-Time Error '2105': You can't got the
specified record"
After I click 'End' the 2 controls I have on the form disappear?!
This occurs only
with one of my forms. I deliberately added a record type to all
others table to try to
reproduce the error but it doesn't happen. It simply displays no
records, which is fine,
Any help will be appreciated.

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