Search form combobox to display results on other form

W

Windstorm

Ok,

Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub

Thanks!!!
 
M

Marshall Barton

Windstorm said:
Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub


It's no surprise that the consultant is no longer around.
If I wrote code like that, I would leave town too. ;-)

Based on the information you posted, I think the code should
be:

Private Sub Combo2_Click()
With Forms!dcdoc.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "[DocKeyID]=" & Me.Combo2
If Not .NoMatch Then
Forms!dcdoc.Bookmark = .Bookmark
End If
End If
End With
DoCmd.Close acForm, "dcdocbrowse"
End Sub
 
W

Windstorm

Marshall Barton said:
Windstorm said:
Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub


It's no surprise that the consultant is no longer around.
If I wrote code like that, I would leave town too. ;-)

Based on the information you posted, I think the code should
be:

Private Sub Combo2_Click()
With Forms!dcdoc.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "[DocKeyID]=" & Me.Combo2
If Not .NoMatch Then
Forms!dcdoc.Bookmark = .Bookmark
End If
End If
End With
DoCmd.Close acForm, "dcdocbrowse"
End Sub

Thanks for your help! However, I entered in the code and I still got an
error. "Run-time error '2467': The expression you entered refers to an
object that is closed or doesn't exist." It seems to be pointing to the
'With Forms!dcdoc.RecordsetClone'.

Now, by no means do I know what I'm talking about. I had a similar error
with the prior code and researched it. Someone mentioned that you could have
a corrupted database if there were more than 250 records in the form. In
this particular form, there are over 1,000 records. Have no idea if this is
a contributing factor, just putting it out there.

I really do appreciate your help. This makes me want to dive head first
into Visual Basic.

Thanks again!
 
W

Windstorm

Windstorm said:
Marshall Barton said:
Windstorm said:
Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub


It's no surprise that the consultant is no longer around.
If I wrote code like that, I would leave town too. ;-)

Based on the information you posted, I think the code should
be:

Private Sub Combo2_Click()
With Forms!dcdoc.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "[DocKeyID]=" & Me.Combo2
If Not .NoMatch Then
Forms!dcdoc.Bookmark = .Bookmark
End If
End If
End With
DoCmd.Close acForm, "dcdocbrowse"
End Sub

Thanks for your help! However, I entered in the code and I still got an
error. "Run-time error '2467': The expression you entered refers to an
object that is closed or doesn't exist." It seems to be pointing to the
'With Forms!dcdoc.RecordsetClone'.

Now, by no means do I know what I'm talking about. I had a similar error
with the prior code and researched it. Someone mentioned that you could have
a corrupted database if there were more than 250 records in the form. In
this particular form, there are over 1,000 records. Have no idea if this is
a contributing factor, just putting it out there.

I really do appreciate your help. This makes me want to dive head first
into Visual Basic.

Thanks again!

Oh,

Just to make things grand, I tried a few different things, re-entered your
code, only to find that now I get the "Run-time error '3420': Object Invalid
or no longer set" pointing to 'If .RecordCount > 0 Then'. At one point, I
entered your code, received no error, but it didn't return any results on the
main form. Thoroughly confused and hoping you can help me out.

Thanks!
 
M

Marshall Barton

Windstorm said:
Marshall Barton said:
Windstorm said:
Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub


It's no surprise that the consultant is no longer around.
If I wrote code like that, I would leave town too. ;-)

Based on the information you posted, I think the code should
be:

Private Sub Combo2_Click()
With Forms!dcdoc.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "[DocKeyID]=" & Me.Combo2
If Not .NoMatch Then
Forms!dcdoc.Bookmark = .Bookmark
End If
End If
End With
DoCmd.Close acForm, "dcdocbrowse"
End Sub

Thanks for your help! However, I entered in the code and I still got an
error. "Run-time error '2467': The expression you entered refers to an
object that is closed or doesn't exist." It seems to be pointing to the
'With Forms!dcdoc.RecordsetClone'.

Now, by no means do I know what I'm talking about. I had a similar error
with the prior code and researched it. Someone mentioned that you could have
a corrupted database if there were more than 250 records in the form. In
this particular form, there are over 1,000 records. Have no idea if this is
a contributing factor, just putting it out there.

I really do appreciate your help. This makes me want to dive head first
into Visual Basic.


That error usually means either that the form dcdoc is not
open or that you misspelled its name.
 
M

Marshall Barton

Windstorm said:
Windstorm said:
Marshall Barton said:
Windstorm wrote:
Please be patient with me, I'm about to confuse everyone, including myself.
I have agreed to help a friend with their database issues. I know enough to
get myself in trouble. It was designed in with Access 95 and converted to
Access 2000 for them by a consultant no longer around.

On the main form, there is a "Browse" button which will open up
"dcdocbrowse". It is simply a combobox that once a record is clicked, will
close and will display that record on the main form. This being said, when
you choose a record, it simply displays "Object invalid or no longer set". I
have tried various things and I am stumped. Any help would be greatly
appreciated.

Private Sub Combo2_Click()
DoCmd.SelectObject acForm, "DCDoc"
Forms.dcdoc.RecordsetClone.FindFirst "[DocKeyID]=" & Me!Combo2
'DoCmd.FindRecord Me!Combo2, , True, , acCurrent
DoCmd.GoToRecord , , acGoTo, Forms.dcdoc.RecordsetClone.AbsolutePosition
+ 1
DoCmd.Close acForm, "dcdocbrowse"
End Sub


It's no surprise that the consultant is no longer around.
If I wrote code like that, I would leave town too. ;-)

Based on the information you posted, I think the code should
be:

Private Sub Combo2_Click()
With Forms!dcdoc.RecordsetClone
If .RecordCount > 0 Then
.FindFirst "[DocKeyID]=" & Me.Combo2
If Not .NoMatch Then
Forms!dcdoc.Bookmark = .Bookmark
End If
End If
End With
DoCmd.Close acForm, "dcdocbrowse"
End Sub

Thanks for your help! However, I entered in the code and I still got an
error. "Run-time error '2467': The expression you entered refers to an
object that is closed or doesn't exist." It seems to be pointing to the
'With Forms!dcdoc.RecordsetClone'.

Now, by no means do I know what I'm talking about. I had a similar error
with the prior code and researched it. Someone mentioned that you could have
a corrupted database if there were more than 250 records in the form. In
this particular form, there are over 1,000 records. Have no idea if this is
a contributing factor, just putting it out there.

I really do appreciate your help. This makes me want to dive head first
into Visual Basic.

Just to make things grand, I tried a few different things, re-entered your
code, only to find that now I get the "Run-time error '3420': Object Invalid
or no longer set" pointing to 'If .RecordCount > 0 Then'. At one point, I
entered your code, received no error, but it didn't return any results on the
main form. Thoroughly confused and hoping you can help me out.


Without knowing what you tried and the result of each try, I
can not make a meaningful contribution to this part of the
discussion.
..
 

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