Search Forms

G

Guest

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!
 
G

Guest

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


awach said:
I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

Klatuu said:
What is wrong with the FindFirst method? That is what I would use.
 
G

Guest

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


Klatuu said:
The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


awach said:
I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

Klatuu said:
What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


awach said:
What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


Klatuu said:
The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


awach said:
I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

Klatuu said:
Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


awach said:
What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


Klatuu said:
The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


awach said:
The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

Klatuu said:
Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


awach said:
What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

OK, I understand. I am not getting an error that Microsoft does not
recognize 'Switchboard' as a vaild field name or expression. When I use the
debugger I see that this is shown when I rest the cursor on Me.Open Arg

Me.OpenArg="Switchboard"

How can I change that and what do I change it to?

Thank you!

Klatuu said:
Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


awach said:
The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

Klatuu said:
Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


:

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

Something is not right. You should not be passing the name of the form,but
the current value of the combo box.
Post back with the code you are actually using, please.
--
Dave Hargis, Microsoft Access MVP


awach said:
OK, I understand. I am not getting an error that Microsoft does not
recognize 'Switchboard' as a vaild field name or expression. When I use the
debugger I see that this is shown when I rest the cursor on Me.Open Arg

Me.OpenArg="Switchboard"

How can I change that and what do I change it to?

Thank you!

Klatuu said:
Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


awach said:
The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

:

Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


:

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

Combo box on switchboard:

Private Sub Name_AfterUpdate()
DoCmd.OpenForm "Clients", , , , , , Me.Name

End Sub

Load Even on Clients:

Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
With Me.RecordsetClone
.FindFirst "[LastName] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End If

End Sub

Klatuu said:
Something is not right. You should not be passing the name of the form,but
the current value of the combo box.
Post back with the code you are actually using, please.
--
Dave Hargis, Microsoft Access MVP


awach said:
OK, I understand. I am not getting an error that Microsoft does not
recognize 'Switchboard' as a vaild field name or expression. When I use the
debugger I see that this is shown when I rest the cursor on Me.Open Arg

Me.OpenArg="Switchboard"

How can I change that and what do I change it to?

Thank you!

Klatuu said:
Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


:

The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

:

Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


:

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

DoCmd.OpenForm "Clients", , , , , , Me.Name

Not what you want. This is passing the the name of the form, which is
Switchboard. Part of the problem is you are using Name as a Name. Name is
an Access reserved word and this is the kind of problem it will cause.
Access is confused because he sees Name as a property of Me that returns Me's
name.
Change the name of your combo. Try something like cboClient. Then

Private Sub cboClient_AfterUpdate()
DoCmd.OpenForm "Clients", , , , , , Me.cboClient
End Sub

--
Dave Hargis, Microsoft Access MVP


awach said:
Combo box on switchboard:

Private Sub Name_AfterUpdate()
DoCmd.OpenForm "Clients", , , , , , Me.Name

End Sub

Load Even on Clients:

Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
With Me.RecordsetClone
.FindFirst "[LastName] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End If

End Sub

Klatuu said:
Something is not right. You should not be passing the name of the form,but
the current value of the combo box.
Post back with the code you are actually using, please.
--
Dave Hargis, Microsoft Access MVP


awach said:
OK, I understand. I am not getting an error that Microsoft does not
recognize 'Switchboard' as a vaild field name or expression. When I use the
debugger I see that this is shown when I rest the cursor on Me.Open Arg

Me.OpenArg="Switchboard"

How can I change that and what do I change it to?

Thank you!

:

Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


:

The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

:

Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


:

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 
G

Guest

I think that did the trick. Thank you so much!!!

Klatuu said:
DoCmd.OpenForm "Clients", , , , , , Me.Name

Not what you want. This is passing the the name of the form, which is
Switchboard. Part of the problem is you are using Name as a Name. Name is
an Access reserved word and this is the kind of problem it will cause.
Access is confused because he sees Name as a property of Me that returns Me's
name.
Change the name of your combo. Try something like cboClient. Then

Private Sub cboClient_AfterUpdate()
DoCmd.OpenForm "Clients", , , , , , Me.cboClient
End Sub

--
Dave Hargis, Microsoft Access MVP


awach said:
Combo box on switchboard:

Private Sub Name_AfterUpdate()
DoCmd.OpenForm "Clients", , , , , , Me.Name

End Sub

Load Even on Clients:

Private Sub Form_Load()
If Not IsNull(Me.OpenArgs) Then
With Me.RecordsetClone
.FindFirst "[LastName] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End If

End Sub

Klatuu said:
Something is not right. You should not be passing the name of the form,but
the current value of the combo box.
Post back with the code you are actually using, please.
--
Dave Hargis, Microsoft Access MVP


:

OK, I understand. I am not getting an error that Microsoft does not
recognize 'Switchboard' as a vaild field name or expression. When I use the
debugger I see that this is shown when I rest the cursor on Me.Open Arg

Me.OpenArg="Switchboard"

How can I change that and what do I change it to?

Thank you!

:

Okay, I think you can do this from the Switchboard.
Does the combo box on the switchboard have a row source based on your Client
Table? If so, then here is how you can do it without a filter. The
FindFirst will not work in this case because the Client form is not yet open
and, as I stated previously, the switchboard has no row source.

So, in the After Update event of the combo use the OpenArgs argument of the
OpenForm method.

Docmd.OpenForm "frmClient", , , , , , Me.MyCombo

Now, in the Load event of the client form:

If Not IsNull(Me.OpenARgs) Then
With Me.RecordsetClone
.FindFirst "[ClientID] = " & Me.OpenArgs
If .NoMatch Then
MsgBox "Client " & Me.OpenArgs & " Not Found"
Else
Me.BookMark = .BookMark
End If
End With
End If

So what has happened is we have used the FindFirst to get the client, but
since we have to do it within the Client form, we have passed the client's
identifier to the form so it know which client to pull up.
--
Dave Hargis, Microsoft Access MVP


:

The switchboard opens when the db is opened. It serves as a guide/pointer to
all the forms and reports. One of the main forms used most often is the
Client form so I wanted a quick way to get to the client form and a specific
client from the main/opening page (at this point, the Switchboard). In order
to do that I created a combo box listing all the client's name. The user has
the option to select a last name from that list and go directly to their
client page. This avoids the steps of having to open the clients form and
then do a separate search there.

Like I wrote before, I tried using a filtering method but it is creating an
error so I'm not sure what else I can do.

I supposed I could make another form in leiu of the Switchboard but I think
it would have the same issues because it's not bound to anything.

What do you think I should do?

:

Create a new form in design view.
What you are doing is not appropriate for the switchboard.
Maybe if you could describe in some detail what you are attempting to
accomplish, I could give some more detailed assistance.
--
Dave Hargis, Microsoft Access MVP


:

What do you mean when you sau "use your own form"? (sorry, I'm still learning)

I tried posting the code you supplied on the AfterUpdate of the Switchboard
search and it returns an error that Combo161 cannot be found. How do I fix
this?

Thanks!!!


:

The problem here is that the Switchboard doesn't have a Row Source. In other
words, there is no recordset for the switchboard.
I would suggest you use your own form and just open the form from the
switchboard. Then the code you posted should work. Just to disect it for
you:

This has some issues. Microsoft does some really bad programming.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

This would be my version:

With Me.RecordsetClone 'Use the form's
recordsetclone for the
'following
operations
.FindFirst "[LastName] = '" & Me.Combo161 & "'"
'Find the first
record where the LastName
'Field in the
recordset is equal to the
'value in the
control named Combo161
'on the Active
Form
If .NoMatch Then 'A match was not found
MsgBox "Record Not Found"
Else
Me.BookMark = .BookMark 'Make the record found in the
'recordsetclone
the current record on
'the form
End If
End With 'Ends the With
statement.

--
Dave Hargis, Microsoft Access MVP


:

I think the FindFirst method would work fine but I don't know how to do it.
I originally used it with the combo box wizard so I don't know how to write
the actual code. I have

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LastName] = '" & Me![Combo161] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

for the combo box but because it is being opened from the Switchboard form
and not the [Clients] from, the Me. part doesn't work. I've tried replacing
that with the full location (Set rs=Forms!Switchboard!Search) name but it
still doesn't seem to work. How can I make this work? Thanks!

:

What is wrong with the FindFirst method? That is what I would use.
--
Dave Hargis, Microsoft Access MVP


:

I have a switchboard and a main client form. On the main client form I used
the combo box wizard to create a searching combo box-the user selects the
client name from the box and is taken to the first match (no filter, uses the
FindFind method).

I also have another combo box on my switch board as a shortcut. The user
can select the client's name from that list and go directly to the client
page with the matching last name. That combo is using a filtering method
which is causing an error that forces the entire access program to quit.

I'm think that if I can search without using a filter with the FindFirst (or
something similar) I could get rid of the error. ...But, I've been
troubleshooting for a while and come up with nothing. Any ideas? Thanks.


Forms:Switchboard, Clients
Controls: SwitchboardSearch, ClientSearch
 

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