|
 |
access thread: FindFirst
Message #1 by papparuff@c... on Sat, 23 Feb 2002 17:12:27
|
|
I have seen a lot of postings where people cannot get the FindFirst
sample code from the knowledgebase and other locations to work properly.
The reason is because the sample code is incomplete. The rst in
rst.FindFirst has not been declared so errors are occuring. Here is the
full code. (Make sure there is a reference Microsoft DAO x.x Object
Library - where x.x is the latest version you have)
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
'Find the record that matches the control
With rst
.FindFirst "[CustomerID] = '" & Combo12 & "'"
If .NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = .Bookmark
End If
.Close
End With
Set rst = Nothing
I hope this helps,
John V. Ruff - The Eternal Optimist :-)
Message #2 by "Andrew Payne" <andrewpayne.plastics@b...> on Mon, 25 Feb 2002 11:44:39
|
|
Thanks for posting the code, it actually goes to and displays the correct
record, but (in my project)it also replaces the original data that would
be in Combo12 with the data that i search for. Do you have any ideas how i
can resolve this?
Thanks in advance
Andrew
> I have seen a lot of postings where people cannot get the FindFirst
> sample code from the knowledgebase and other locations to work properly.
> The reason is because the sample code is incomplete. The rst in
> rst.FindFirst has not been declared so errors are occuring. Here is the
> full code. (Make sure there is a reference Microsoft DAO x.x Object
> Library - where x.x is the latest version you have)
>
> Dim rst As DAO.Recordset
>
> Set rst = Me.RecordsetClone
>
> 'Find the record that matches the control
> With rst
> .FindFirst "[CustomerID] = '" & Combo12 & "'"
>
> If .NoMatch Then
> MsgBox "Record not found"
> Else
> Me.Bookmark = .Bookmark
> End If
>
> .Close
> End With
> Set rst = Nothing
>
> I hope this helps,
>
> John V. Ruff - The Eternal Optimist :-)
Message #3 by "John Ruff" <papparuff@c...> on Mon, 25 Feb 2002 04:12:06 -0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0027_01C1BDB2.96B27270
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I'm sorry Andrew but I don't understand what you are saying.
I think you are saying that if you select the name George Anderson
(sample only) in Combo12 then the form is populated with George
Anderson's data and the Combo12 also says George Anderson.
If this is what you are saying then everything is as it should be. If
you don't want George Anderson to be displayed in Combo12 after his
records are placed on the form then you can set Combo12 to "". The best
place to put it would be
Else
Me.Bookmark = .Bookmark
Combo12 = ""
End If
John Ruff - The Eternal Optimist J
Always looking for Contract Opportunities
9306 Farwest Dr SW
Lakewood, WA 98498
papparuff@c...
-----Original Message-----
From: Andrew Payne [mailto:andrewpayne.plastics@b...]
Sent: Monday, February 25, 2002 11:45 AM
To: Access
Subject: [access] Re: FindFirst
Thanks for posting the code, it actually goes to and displays the
correct
record, but (in my project)it also replaces the original data that would
be in Combo12 with the data that i search for. Do you have any ideas how
i
can resolve this?
Thanks in advance
Andrew
> I have seen a lot of postings where people cannot get the FindFirst
> sample code from the knowledgebase and other locations to work
properly.
> The reason is because the sample code is incomplete. The rst in
> rst.FindFirst has not been declared so errors are occuring. Here is
the
> full code. (Make sure there is a reference Microsoft DAO x.x Object
> Library - where x.x is the latest version you have)
>
> Dim rst As DAO.Recordset
>
> Set rst = Me.RecordsetClone
>
> 'Find the record that matches the control
> With rst
> .FindFirst "[CustomerID] = '" & Combo12 & "'"
>
> If .NoMatch Then
> MsgBox "Record not found"
> Else
> Me.Bookmark = .Bookmark
> End If
>
> .Close
> End With
> Set rst = Nothing
>
> I hope this helps,
>
> John V. Ruff - The Eternal Optimist :-)
Message #4 by "Andrew Payne" <andrewpayne.plastics@b...> on Mon, 25 Feb 2002 12:30:09
|
|
Sorry i should have made it clearer.
Say that the current record displays Ben Hill in combo12 and i select it
to look for George Anderson. The form will display the record for George
Anderson (all ok there) but it replaces the name on the record for Ben
Hill with George Anderson but leave the rest of the data on that record as
it was.
Andrew
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> I'm sorry Andrew but I don't understand what you are saying.
>
> I think you are saying that if you select the name George Anderson
> (sample only) in Combo12 then the form is populated with George
> Anderson's data and the Combo12 also says George Anderson.
>
> If this is what you are saying then everything is as it should be. If
> you don't want George Anderson to be displayed in Combo12 after his
> records are placed on the form then you can set Combo12 to "". The best
> place to put it would be
>
> Else
> Me.Bookmark = .Bookmark
> Combo12 = ""
> End If
>
>
>
> John Ruff - The Eternal Optimist J
>
> Always looking for Contract Opportunities
>
>
>
> 9306 Farwest Dr SW
>
> Lakewood, WA 98498
>
> papparuff@c...
>
>
>
> -----Original Message-----
> From: Andrew Payne [mailto:andrewpayne.plastics@b...]
> Sent: Monday, February 25, 2002 11:45 AM
> To: Access
> Subject: [access] Re: FindFirst
>
>
> Thanks for posting the code, it actually goes to and displays the
> correct
> record, but (in my project)it also replaces the original data that would
> be in Combo12 with the data that i search for. Do you have any ideas how
> i
> can resolve this?
>
> Thanks in advance
> Andrew
>
>
> > I have seen a lot of postings where people cannot get the FindFirst
> > sample code from the knowledgebase and other locations to work
> properly.
> > The reason is because the sample code is incomplete. The rst in
> > rst.FindFirst has not been declared so errors are occuring. Here is
> the
> > full code. (Make sure there is a reference Microsoft DAO x.x Object
> > Library - where x.x is the latest version you have)
> >
> > Dim rst As DAO.Recordset
> >
> > Set rst = Me.RecordsetClone
> >
> > 'Find the record that matches the control
> > With rst
> > .FindFirst "[CustomerID] = '" & Combo12 & "'"
> >
> > If .NoMatch Then
> > MsgBox "Record not found"
> > Else
> > Me.Bookmark = .Bookmark
> > End If
> >
> > .Close
> > End With
> > Set rst = Nothing
> >
> > I hope this helps,
> >
> > John V. Ruff - The Eternal Optimist :-)
>
>
>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/html;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
> charset=3Dus-ascii">
> <TITLE>Message</TITLE>
>
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR></HEAD>
> <BODY><!-- Converted from text/plain format -->
> <P><FONT size=3D2>I'm sorry Andrew but I don't understand what you are
> saying. <BR><BR>I think you are saying that if you select the name
> George
> Anderson (sample only) in Combo12 then the form is populated with George
>
> Anderson's data and the Combo12 also says George Anderson.<BR><BR>If
> this is
> what you are saying then everything is as it should be. If you
> don't want
> George Anderson to be displayed in Combo12 after his records are placed
> on the
> form then you can set Combo12 to "". The best place to put it
> would
> be<BR><BR>Else<BR> Me.Bookmark =3D
> .Bookmark<BR> Combo12 =3D ""<BR>End If<BR><BR></P>
> <DIV align=3Dleft>
> <P class=3DMsoNormal style=3D"MARGIN: 5pt 0in; mso-layout-grid-align:
> none"><B
> style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">John
> Ruff </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: navy; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">-
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: #993366; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">The
> Eternal Optimist</SPAN></I></B><B style=3D"mso-bidi-font-weight:
> normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: teal; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: green; FONT-FAMILY: Wingdings;
> mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: yes;
> mso-ascii-font-family: 'Lucida Calligraphy'; mso-hansi-font-family:
> 'Lucida Calligraphy'; mso-char-type: symbol; mso-symbol-font-family:
> Wingdings"><SPAN
> style=3D"mso-char-type: symbol; mso-symbol-font-family:
> Wingdings">J</SPAN></SPAN><SPAN
> style=3D"mso-no-proof: yes"><?xml:namespace prefix =3D o ns =3D
> "urn:schemas-microsoft-com:office:office"
> /><o:p></o:p></SPAN></I></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Always
> looking for Contract Opportunities<o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B
> style=3D"mso-bidi-font-weight: normal"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p> </o:p></SPAN></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><?xml:namespace
> prefix =3D st1 ns =3D
> "urn:schemas-microsoft-com:office:smarttags"
> /><st1:Street><st1:address><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">9306 Farwest
> Dr
> SW</SPAN></st1:address></st1:Street><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in
> 0pt"><st1:place><st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Lakewood</SPAN></st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">,
> </SPAN><st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">WA</SPAN></st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">
> </SPAN><st1:PostalCode><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">98498</SPAN></st1:PostalCode></st1:place><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">papparuff@c...<o:p></o:p></SPAN></P></DIV>
> <P><BR><BR>-----Original Message-----<BR>From: Andrew Payne [<A
>
href=3D"mailto:andrewpayne.plastics@b...">mailto:andrewpayne.pl
> astics@b...</A>]<BR>Sent:
> Monday, February 25, 2002 11:45 AM<BR>To: Access<BR>Subject: [access]
> Re:
> FindFirst<BR><BR><BR>Thanks for posting the code, it actually goes to
> and
> displays the correct<BR>record, but (in my project)it also replaces the
> original
> data that would<BR>be in Combo12 with the data that i search for. Do you
> have
> any ideas how i<BR>can resolve this?<BR><BR>Thanks in
> advance<BR> Andrew<BR><BR><BR>> I have
> seen a
> lot of postings where people cannot get the FindFirst<BR>> sample
> code from
> the knowledgebase and other locations to work properly.<BR>> The
> reason is
> because the sample code is incomplete. The rst in<BR>>
> rst.FindFirst
> has not been declared so errors are occuring. Here is the<BR>>
> full
> code. (Make sure there is a reference Microsoft DAO x.x
> Object<BR>>
> Library - where x.x is the latest version you
> have)<BR>><BR>> Dim rst As
>
DAO.Recordset<BR>> <BR>> &n
> bsp;
> Set rst =3D
>
Me.RecordsetClone<BR>> <BR>> &nbs
> p;
> 'Find the record that matches the
> control<BR>> With
> rst<BR>> .FindFirst
> "[CustomerID] =3D '" & Combo12 &
>
"'"<BR>> <BR>>
>
> If .NoMatch
>
Then<BR>> &
> nbsp;
> MsgBox "Record not
> found"<BR>>
>
Else<BR>> &
> nbsp;
> Me.Bookmark =3D
> .Bookmark<BR>>
> End
>
If<BR>> <BR>> &
;
> nbsp;
> .Close<BR>> End
> With<BR>>
> Set rst =3D Nothing<BR>><BR>> I hope this helps,<BR>><BR>>
> John V.
> Ruff - The Eternal Optimist :-)<BR><BR>---<BR>Change your mail options
> at <A
>
href=3D"http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp<
> /A>
> or<BR>
> $subst('Email.Unsub').<BR></FONT></P></BODY></HTML>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270--
>
Message #5 by "John Ruff" <papparuff@c...> on Mon, 25 Feb 2002 04:38:15 -0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_002E_01C1BDB6.3E013A90
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
That's what it is suppose to do.
Let's say the form is currently displaying Ben Hills' data and it looks
like this:
Ben Hill
555 South St.
St Louis MO 11111
Lets say that George Anderson lives at 123 Gravelly Lake Dr. Tacoma, Wa
98498.
Now we go to the combobox and select George Anderson. The routine finds
George in the table/query and it now replaces Ben Hill information with
George Anderson
123 Gravelly Lake Dr.
Tacoma WA 98498
It didn't actually replace Ben Hill's information with George
Anderson's. It moved to George Anderson's record in the database and
then displays that iformation on the form. If you now go to the
combobox and select Ben Hill, his information will be displayed on the
form instead of George Anderson's because the FindFirst method finds
Ben's record in the table/query and moves his information to the form.
I hope this clarifies what the code is doing.
John Ruff - The Eternal Optimist J
Always looking for Contract Opportunities
9306 Farwest Dr SW
Lakewood, WA 98498
papparuff@c...
-----Original Message-----
From: Andrew Payne [mailto:andrewpayne.plastics@b...]
Sent: Monday, February 25, 2002 12:30 PM
To: Access
Subject: [access] Re: FindFirst
Sorry i should have made it clearer.
Say that the current record displays Ben Hill in combo12 and i select it
to look for George Anderson. The form will display the record for
George
Anderson (all ok there) but it replaces the name on the record for Ben
Hill with George Anderson but leave the rest of the data on that record
as
it was.
Andrew
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> I'm sorry Andrew but I don't understand what you are saying.
>
> I think you are saying that if you select the name George Anderson
> (sample only) in Combo12 then the form is populated with George
> Anderson's data and the Combo12 also says George Anderson.
>
> If this is what you are saying then everything is as it should be. If
> you don't want George Anderson to be displayed in Combo12 after his
> records are placed on the form then you can set Combo12 to "". The
> best place to put it would be
>
> Else
> Me.Bookmark = .Bookmark
> Combo12 = ""
> End If
>
>
>
> John Ruff - The Eternal Optimist J
>
> Always looking for Contract Opportunities
>
>
>
> 9306 Farwest Dr SW
>
> Lakewood, WA 98498
>
> papparuff@c...
>
>
>
> -----Original Message-----
> From: Andrew Payne [mailto:andrewpayne.plastics@b...]
> Sent: Monday, February 25, 2002 11:45 AM
> To: Access
> Subject: [access] Re: FindFirst
>
>
> Thanks for posting the code, it actually goes to and displays the
> correct record, but (in my project)it also replaces the original data
> that would be in Combo12 with the data that i search for. Do you have
> any ideas how i
> can resolve this?
>
> Thanks in advance
> Andrew
>
>
> > I have seen a lot of postings where people cannot get the FindFirst
> > sample code from the knowledgebase and other locations to work
> properly.
> > The reason is because the sample code is incomplete. The rst in
> > rst.FindFirst has not been declared so errors are occuring. Here is
> the
> > full code. (Make sure there is a reference Microsoft DAO x.x Object
> > Library - where x.x is the latest version you have)
> >
> > Dim rst As DAO.Recordset
> >
> > Set rst = Me.RecordsetClone
> >
> > 'Find the record that matches the control
> > With rst
> > .FindFirst "[CustomerID] = '" & Combo12 & "'"
> >
> > If .NoMatch Then
> > MsgBox "Record not found"
> > Else
> > Me.Bookmark = .Bookmark
> > End If
> >
> > .Close
> > End With
> > Set rst = Nothing
> >
> > I hope this helps,
> >
> > John V. Ruff - The Eternal Optimist :-)
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to $subst('Email.Unsub').
>
>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/html;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
> charset=3Dus-ascii">
> <TITLE>Message</TITLE>
>
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR></HEAD>
> <BODY><!-- Converted from text/plain format -->
> <P><FONT size=3D2>I'm sorry Andrew but I don't understand what you
> are=20 saying. <BR><BR>I think you are saying that if you select
> the name = George=20 Anderson (sample only) in Combo12 then the form
> is populated with George
>
> Anderson's data and the Combo12 also says George Anderson.<BR><BR>If
> this is=20 what you are saying then everything is as it should
> be. If you = don't want
> George Anderson to be displayed in Combo12 after his records are
placed
> on the
> form then you can set Combo12 to "". The best place to put it
> would
> be<BR><BR>Else<BR> Me.Bookmark =3D
> .Bookmark<BR> Combo12 =3D ""<BR>End If<BR><BR></P>
> <DIV align=3Dleft>
> <P class=3DMsoNormal style=3D"MARGIN: 5pt 0in; mso-layout-grid-align:
> none"><B
> style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy';
mso-no-proof:
> yes">John
> Ruff </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: navy; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy';
mso-no-proof:
> yes">-
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: #993366; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy';
mso-no-proof:
> yes">The
> Eternal Optimist</SPAN></I></B><B style=3D"mso-bidi-font-weight:
> normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: teal; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy';
mso-no-proof:
> yes">
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: green; FONT-FAMILY: Wingdings;
> mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: yes;
> mso-ascii-font-family: 'Lucida Calligraphy'; mso-hansi-font-family:
> 'Lucida Calligraphy'; mso-char-type: symbol; mso-symbol-font-family:
> Wingdings"><SPAN
> style=3D"mso-char-type: symbol; mso-symbol-font-family:
> Wingdings">J</SPAN></SPAN><SPAN
> style=3D"mso-no-proof: yes"><?xml:namespace prefix =3D o ns =3D
> "urn:schemas-microsoft-com:office:office"
> /><o:p></o:p></SPAN></I></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Always
> looking for Contract Opportunities<o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B
> style=3D"mso-bidi-font-weight: normal"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p> </o:p></SPAN></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><?xml:namespace
> prefix =3D st1 ns =3D
> "urn:schemas-microsoft-com:office:smarttags"
> /><st1:Street><st1:address><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">9306 Farwest
> Dr
> SW</SPAN></st1:address></st1:Street><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in
> 0pt"><st1:place><st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Lakewood</SPAN></st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">,
> </SPAN><st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">WA</SPAN></st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">
> </SPAN><st1:PostalCode><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">98498</SPAN></st1:PostalCode></st1:place><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">papparuff@c...<o:p></o:p></SPAN></P></DIV>
> <P><BR><BR>-----Original Message-----<BR>From: Andrew Payne [<A
>
href=3D"mailto:andrewpayne.plastics@b...">mailto:andrewpayne.p
l
> astics@b...</A>]<BR>Sent:
> Monday, February 25, 2002 11:45 AM<BR>To: Access<BR>Subject: [access]
> = Re:=20 FindFirst<BR><BR><BR>Thanks for posting the code, it actually
> goes to = and
> displays the correct<BR>record, but (in my project)it also replaces
the
> original
> data that would<BR>be in Combo12 with the data that i search for. Do
you
> have
> any ideas how i<BR>can resolve this?<BR><BR>Thanks in
> advance<BR> Andrew<BR><BR><BR>> I
> have = seen a=20 lot of postings where people cannot get the
> FindFirst<BR>> sample = code from
> the knowledgebase and other locations to work properly.<BR>> The
> reason is
> because the sample code is incomplete. The rst in<BR>>
> rst.FindFirst
> has not been declared so errors are occuring. Here is
the<BR>>
> full
> code. (Make sure there is a reference Microsoft DAO x.x
> Object<BR>>
> Library - where x.x is the latest version you
> have)<BR>><BR>> Dim rst As
>
DAO.Recordset<BR>> <BR>> &
n
> bsp;
> Set rst =3D
>
Me.RecordsetClone<BR>> <BR>> &nb
s
> p;
> 'Find the record that matches the
> control<BR>> With
> rst<BR>>
> .FindFirst=20 "[CustomerID] =3D '" & Combo12 &
> "'"<BR>> <BR>>&nb
> sp;
>
> If .NoMatch
>
Then<BR>>
&
> nbsp;
> MsgBox "Record not
> found"<BR>>
>
Else<BR>>
&
> nbsp;
> Me.Bookmark =3D
> .Bookmark<BR>>
> End
>
If<BR>> <BR>>
&
> nbsp;
> .Close<BR>> End
> With<BR>>
> Set rst =3D Nothing<BR>><BR>> I hope this helps,<BR>><BR>>
> = John V.=20 Ruff - The Eternal Optimist :-)<BR><BR>---<BR>Change your
> mail options = at <A
>
href=3D"http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp
<
> /A>
> or<BR>
> $subst('Email.Unsub').<BR></FONT></P>
---<BR>
Change your mail options at http://p2p.wrox.com/manager.asp or <BR> to
unsubscribe send a blank email to $subst('Email.Unsub').
</BODY></HTML>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270--
>
Message #6 by "Andrew Payne" <andrewpayne.plastics@b...> on Mon, 25 Feb 2002 13:43:05
|
|
I'm rubbish at explaining myself so i'll have 1 last try
Lets say the table shows the data as
Ben Hill George Anderson
555 South St. 123 Gravely Lake Dr.
St Louis, MO 11111 Tacoma, WA 98498
In the form it opens up with Ben Hill's data, when i click on the combo
box it comes up with a list something like this:
Ben Hill
George Anderson
Patrick Stewart
When I select George Anderson it shows his data fine, but when i click on
the combo box again it looks like this:
George Anderson
George Anderson
Patrick Stewart
and in the table the records now show this.
George Anderson George Anderson
555 South St. 123 Gravely Lake Dr.
St Louis, MO 11111 Tecoma, WA 98498
so for some reason Ben Hill's name is being replaced by George Anderson's
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_002E_01C1BDB6.3E013A90
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> That's what it is suppose to do.
>
> Let's say the form is currently displaying Ben Hills' data and it looks
> like this:
>
> Ben Hill
>
> 555 South St.
> St Louis MO 11111
>
> Lets say that George Anderson lives at 123 Gravelly Lake Dr. Tacoma, Wa
> 98498.
>
> Now we go to the combobox and select George Anderson. The routine finds
> George in the table/query and it now replaces Ben Hill information with
>
> George Anderson
>
> 123 Gravelly Lake Dr.
> Tacoma WA 98498
>
> It didn't actually replace Ben Hill's information with George
> Anderson's. It moved to George Anderson's record in the database and
> then displays that iformation on the form. If you now go to the
> combobox and select Ben Hill, his information will be displayed on the
> form instead of George Anderson's because the FindFirst method finds
> Ben's record in the table/query and moves his information to the form.
>
> I hope this clarifies what the code is doing.
>
>
>
> John Ruff - The Eternal Optimist J
>
> Always looking for Contract Opportunities
>
>
>
> 9306 Farwest Dr SW
>
> Lakewood, WA 98498
>
> papparuff@c...
>
>
>
Message #7 by "John Ruff" <papparuff@c...> on Mon, 25 Feb 2002 05:48:41 -0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0035_01C1BDC0.150B5800
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Andrew,
The code does not replace Ben Hill's data with George Anderson's data.
Somewhere else in your code this is being accomplished. If you send me
the db I'll see if I can help determine what is happening. Please
compact it first and if you have Winzip, zip it up.
John Ruff - The Eternal Optimist J
Always looking for Contract Opportunities
9306 Farwest Dr SW
Lakewood, WA 98498
papparuff@c...
-----Original Message-----
From: Andrew Payne [mailto:andrewpayne.plastics@b...]
Sent: Monday, February 25, 2002 1:43 PM
To: Access
Subject: [access] Re: FindFirst
I'm rubbish at explaining myself so i'll have 1 last try
Lets say the table shows the data as
Ben Hill George Anderson
555 South St. 123 Gravely Lake Dr.
St Louis, MO 11111 Tacoma, WA 98498
In the form it opens up with Ben Hill's data, when i click on the combo
box it comes up with a list something like this:
Ben Hill
George Anderson
Patrick Stewart
When I select George Anderson it shows his data fine, but when i click
on
the combo box again it looks like this:
George Anderson
George Anderson
Patrick Stewart
and in the table the records now show this.
George Anderson George Anderson
555 South St. 123 Gravely Lake Dr.
St Louis, MO 11111 Tecoma, WA 98498
so for some reason Ben Hill's name is being replaced by George
Anderson's
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_002E_01C1BDB6.3E013A90
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> That's what it is suppose to do.
>
> Let's say the form is currently displaying Ben Hills' data and it
> looks like this:
>
> Ben Hill
>
> 555 South St.
> St Louis MO 11111
>
> Lets say that George Anderson lives at 123 Gravelly Lake Dr. Tacoma,
> Wa 98498.
>
> Now we go to the combobox and select George Anderson. The routine
> finds George in the table/query and it now replaces Ben Hill
> information with
>
> George Anderson
>
> 123 Gravelly Lake Dr.
> Tacoma WA 98498
>
> It didn't actually replace Ben Hill's information with George
> Anderson's. It moved to George Anderson's record in the database and
> then displays that iformation on the form. If you now go to the
> combobox and select Ben Hill, his information will be displayed on the
> form instead of George Anderson's because the FindFirst method finds
> Ben's record in the table/query and moves his information to the form.
>
> I hope this clarifies what the code is doing.
>
>
>
> John Ruff - The Eternal Optimist J
>
> Always looking for Contract Opportunities
>
>
>
> 9306 Farwest Dr SW
>
> Lakewood, WA 98498
>
> papparuff@c...
>
>
>
Message #8 by "David Chapman" <luckychap@b...> on Tue, 26 Feb 2002 18:56:18 +1030
|
|
It sounds like you have set the control source of your combobox to a field
in a record. When selecting a name using the combo you are actually
updating the record. Use an unbound combo box by deleting the entry against
the Control Source
David
-----Original Message-----
From: Andrew Payne [mailto:andrewpayne.plastics@b...]
Sent: Monday, February 25, 2002 12:30 PM
To: Access
Subject: [access] Re: FindFirst
Sorry i should have made it clearer.
Say that the current record displays Ben Hill in combo12 and i select it
to look for George Anderson. The form will display the record for George
Anderson (all ok there) but it replaces the name on the record for Ben
Hill with George Anderson but leave the rest of the data on that record as
it was.
Andrew
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> I'm sorry Andrew but I don't understand what you are saying.
>
> I think you are saying that if you select the name George Anderson
> (sample only) in Combo12 then the form is populated with George
> Anderson's data and the Combo12 also says George Anderson.
>
> If this is what you are saying then everything is as it should be. If
> you don't want George Anderson to be displayed in Combo12 after his
> records are placed on the form then you can set Combo12 to "". The best
> place to put it would be
>
> Else
> Me.Bookmark = .Bookmark
> Combo12 = ""
> End If
>
>
>
> John Ruff - The Eternal Optimist J
>
> Always looking for Contract Opportunities
>
>
>
> 9306 Farwest Dr SW
>
> Lakewood, WA 98498
>
> papparuff@c...
>
>
>
> -----Original Message-----
> From: Andrew Payne [mailto:andrewpayne.plastics@b...]
> Sent: Monday, February 25, 2002 11:45 AM
> To: Access
> Subject: [access] Re: FindFirst
>
>
> Thanks for posting the code, it actually goes to and displays the
> correct
> record, but (in my project)it also replaces the original data that would
> be in Combo12 with the data that i search for. Do you have any ideas how
> i
> can resolve this?
>
> Thanks in advance
> Andrew
>
>
> > I have seen a lot of postings where people cannot get the FindFirst
> > sample code from the knowledgebase and other locations to work
> properly.
> > The reason is because the sample code is incomplete. The rst in
> > rst.FindFirst has not been declared so errors are occuring. Here is
> the
> > full code. (Make sure there is a reference Microsoft DAO x.x Object
> > Library - where x.x is the latest version you have)
> >
> > Dim rst As DAO.Recordset
> >
> > Set rst = Me.RecordsetClone
> >
> > 'Find the record that matches the control
> > With rst
> > .FindFirst "[CustomerID] = '" & Combo12 & "'"
> >
> > If .NoMatch Then
> > MsgBox "Record not found"
> > Else
> > Me.Bookmark = .Bookmark
> > End If
> >
> > .Close
> > End With
> > Set rst = Nothing
> >
> > I hope this helps,
> >
> > John V. Ruff - The Eternal Optimist :-)
>
>
>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270
> Content-Type: text/html;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
> charset=3Dus-ascii">
> <TITLE>Message</TITLE>
>
> <META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR></HEAD>
> <BODY><!-- Converted from text/plain format -->
> <P><FONT size=3D2>I'm sorry Andrew but I don't understand what you are
> saying. <BR><BR>I think you are saying that if you select the name
> George
> Anderson (sample only) in Combo12 then the form is populated with George
>
> Anderson's data and the Combo12 also says George Anderson.<BR><BR>If
> this is
> what you are saying then everything is as it should be. If you
> don't want
> George Anderson to be displayed in Combo12 after his records are placed
> on the
> form then you can set Combo12 to "". The best place to put it
> would
> be<BR><BR>Else<BR> Me.Bookmark =3D
> .Bookmark<BR> Combo12 =3D ""<BR>End If<BR><BR></P>
> <DIV align=3Dleft>
> <P class=3DMsoNormal style=3D"MARGIN: 5pt 0in; mso-layout-grid-align:
> none"><B
> style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: blue; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">John
> Ruff </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: navy; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">-
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: #993366; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">The
> Eternal Optimist</SPAN></I></B><B style=3D"mso-bidi-font-weight:
> normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: teal; FONT-FAMILY: 'Lucida
> Calligraphy'; mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof:
> yes">
> </SPAN></I></B><B style=3D"mso-bidi-font-weight: normal"><I
> style=3D"mso-bidi-font-style: normal"><SPAN
> style=3D"FONT-SIZE: 14pt; COLOR: green; FONT-FAMILY: Wingdings;
> mso-bidi-font-family: 'Lucida Calligraphy'; mso-no-proof: yes;
> mso-ascii-font-family: 'Lucida Calligraphy'; mso-hansi-font-family:
> 'Lucida Calligraphy'; mso-char-type: symbol; mso-symbol-font-family:
> Wingdings"><SPAN
> style=3D"mso-char-type: symbol; mso-symbol-font-family:
> Wingdings">J</SPAN></SPAN><SPAN
> style=3D"mso-no-proof: yes"><?xml:namespace prefix =3D o ns =3D
> "urn:schemas-microsoft-com:office:office"
> /><o:p></o:p></SPAN></I></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Always
> looking for Contract Opportunities<o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><B
> style=3D"mso-bidi-font-weight: normal"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p> </o:p></SPAN></B></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><?xml:namespace
> prefix =3D st1 ns =3D
> "urn:schemas-microsoft-com:office:smarttags"
> /><st1:Street><st1:address><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">9306 Farwest
> Dr
> SW</SPAN></st1:address></st1:Street><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in
> 0pt"><st1:place><st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">Lakewood</SPAN></st1:City><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">,
> </SPAN><st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">WA</SPAN></st1:State><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida Calligraphy'">
> </SPAN><st1:PostalCode><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">98498</SPAN></st1:PostalCode></st1:place><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'"><o:p></o:p></SPAN></P>
> <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN
> style=3D"COLOR: black; FONT-FAMILY: 'Lucida
> Calligraphy'">papparuff@c...<o:p></o:p></SPAN></P></DIV>
> <P><BR><BR>-----Original Message-----<BR>From: Andrew Payne [<A
>
href=3D"mailto:andrewpayne.plastics@b...">mailto:andrewpayne.pl
> astics@b...</A>]<BR>Sent:
> Monday, February 25, 2002 11:45 AM<BR>To: Access<BR>Subject: [access]
> Re:
> FindFirst<BR><BR><BR>Thanks for posting the code, it actually goes to
> and
> displays the correct<BR>record, but (in my project)it also replaces the
> original
> data that would<BR>be in Combo12 with the data that i search for. Do you
> have
> any ideas how i<BR>can resolve this?<BR><BR>Thanks in
> advance<BR> Andrew<BR><BR><BR>> I have
> seen a
> lot of postings where people cannot get the FindFirst<BR>> sample
> code from
> the knowledgebase and other locations to work properly.<BR>> The
> reason is
> because the sample code is incomplete. The rst in<BR>>
> rst.FindFirst
> has not been declared so errors are occuring. Here is the<BR>>
> full
> code. (Make sure there is a reference Microsoft DAO x.x
> Object<BR>>
> Library - where x.x is the latest version you
> have)<BR>><BR>> Dim rst As
>
DAO.Recordset<BR>> <BR>> &n
> bsp;
> Set rst =3D
>
Me.RecordsetClone<BR>> <BR>> &nbs
> p;
> 'Find the record that matches the
> control<BR>> With
> rst<BR>> .FindFirst
> "[CustomerID] =3D '" & Combo12 &
>
"'"<BR>> <BR>>
>
> If .NoMatch
>
Then<BR>> &
> nbsp;
> MsgBox "Record not
> found"<BR>>
>
Else<BR>> &
> nbsp;
> Me.Bookmark =3D
> .Bookmark<BR>>
> End
>
If<BR>> <BR>> &
;
> nbsp;
> .Close<BR>> End
> With<BR>>
> Set rst =3D Nothing<BR>><BR>> I hope this helps,<BR>><BR>>
> John V.
> Ruff - The Eternal Optimist :-)<BR><BR>---<BR>Change your mail options
> at <A
>
href=3D"http://p2p.wrox.com/manager.asp">http://p2p.wrox.com/manager.asp<
> /A>
> or<BR>
> $subst('Email.Unsub').<BR></FONT></P>
---<BR>
Change your mail options at http://p2p.wrox.com/manager.asp or <BR>
</BODY></HTML>
>
> ------=_NextPart_000_0027_01C1BDB2.96B27270--
>
|
|
 |