1eecd Problems w/ FindFirst
Sign Up |  Live StatsLive Stats    Articles 37,302| Comments 176,967| Members 19,397, Newest birinder| Online 369
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Problems w/ FindFirst

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 100 USD (20%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Problem with FindFirst Method j Information Technology 4 28-Jul-2006 08:36 AM
having problems!!! Need help if it out there xtermely23 Information Technology 5 28-Jul-2006 08:31 AM
I'm still having problems Accessidiot Information Technology 3 28-Jul-2006 08:25 AM


Tags
findfirst, problems, w or
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:12 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
Problems w/ FindFirst

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
The code below resides in a loop. It works fine, for the first record, but
none of the others. The 'Findfirst' line searches for the proper ItemID,
however, it continues to attempt to update the first record of the table.

Any suggestions on what I'm doing wrong?
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10442-problems-w-findfirst.html
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442

Thanks, in advance.

Sharkbyte


Dim MyDB As Database
Dim MyDetail As Recordset

Set MyDB = CurrentDb()
Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")

..MoveFirst
..FindFirst ("itemid = '" & gblItemID & "' ")

With MyDetail
.Edit
!ItemStatus = "Received"
!QuantityReceived = !QuantityOrdered
.Update
End With


Do share your immediate thoughts or reactions on this issue? We value your views! Login Now! or Sign Up Today! to share your views with us.. Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:12 AM
strive4peace's Avatar strive4peace
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst

Hi Sharkbyte,

Why not use an UPDATE query...

'~~~~~~~~~~~~~~~~~~~~
dim strSQL as string
strSQL = "UPDATE tblpurchaseorderdetails " _
& " SET ItemStatus = 'Received', " _
& " QuantityReceived = nz(QuantityOrdered) " _
& " WHERE itemid '" & gblItemID & "';"
debug.print strSql
currentdb.execute strSQL
'~~~~~~~~~~~~~~~~~~~~
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442

** debug.print ***

debug.print strSQL

--> this prints a copy of the SQL statement to the debug
window (CTRL-G)

After you execute your code, open the Debug window
CTRL-G to Goto the debuG window -- look at the SQL statement

If the SQL statement has an error

1. Make a new query (design view)

2. choose View, SQL from the menu
(or SQL from the toolbar, first icon)

3. cut the SQL statement from the debug window
(select, CTRL-X)

4. paste into the SQL window of the Query
(CTRL-V)

5. run ! from the SQL window
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
-- Access will tell you where the problem is in the SQL


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Sharkbyte wrote:
> The code below resides in a loop. It works fine, for the first record, but
> none of the others. The 'Findfirst' line searches for the proper ItemID,
> however, it continues to attempt to update the first record of the table.
>
> Any suggestions on what I'm doing wrong?
>
> Thanks, in advance.
>
> Sharkbyte
>
>
> Dim MyDB As Database
> Dim MyDetail As Recordset
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> .MoveFirst
> .FindFirst ("itemid = '" & gblItemID & "' ")
>
> With MyDetail
> .Edit
> !ItemStatus = "Received"
> !QuantityReceived = !QuantityOrdered
> .Update
> End With

Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:13 AM
Rob Parker's Avatar Rob Parker
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst

Well, even if that code is within a loop that you haven't shown, it will
not work because you are always telling it to .FindFirst ;-)

Your Dim and Set statements belong outside your loop, and you need to use a
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
..FindNext within the loop. Something like:

Dim MyDB As Database
Dim MyDetail As DAO.Recordset 'disambiguate the recordset type

Set MyDB = CurrentDb()
Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")

..MoveFirst

Do While Not MyDetail.EOF
.FindNext ("itemid = '" & gblItemID & "' ")
With MyDetail
.Edit
!ItemStatus = "Received"
!QuantityReceived = !QuantityOrdered
.Update
End With
Loop

Having said that, I'd actually build and execute an SQL string to do your
update, as Crystal suggests. My reply is merely to assist you in
understanding how to set up a loop that works ;-)

HTH,

Rob


"Sharkbyte" wrote in message
news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
> The code below resides in a loop. It works fine, for the first record,
> but
> none of the others. The 'Findfirst' line searches for the proper ItemID,
> however, it continues to attempt to update the first record of the table.
>
> Any suggestions on what I'm doing wrong?
>
> Thanks, in advance.
>
> Sharkbyte
>
>
> Dim MyDB As Database
> Dim MyDetail As Recordset
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> .MoveFirst
> .FindFirst ("itemid = '" & gblItemID & "' ")
>
> With MyDetail
> .Edit
> !ItemStatus = "Received"
> !QuantityReceived = !QuantityOrdered
> .Update
> End With



Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:13 AM
strive4peace's Avatar strive4peace
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst -- FindFirst before loop, FindNext inloop

Thanks, Rob

It is a good idea to help Sharkbyte understand the logic
errors instead of just suggesting a different method, thanks
for that

just have a couple comments on the code that Rob posted ...

in case the FIRST record contains what is being sought... do
..FindFirst before the loop (do not believe that .FindNext
will stay on the same record...)

Object variables need to be released when you are done with them

'~~~~~~~~~~~~~~~~~~~~~~~~~~
'NEEDS REFERENCE TO
'Microsoft DAO Object Library

Dim MyDB As DAO.Database
Dim MyDetail As DAO.Recordset

Set MyDB = CurrentDb()
Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")

With MyDetail

.FindFirst "itemid = '" & gblItemID & "'"

if not MyDetail.NoMatch then
Do
.Edit
!ItemStatus = "Received"
!QuantityReceived = !QuantityOrdered
.Update
.FindNext "itemid = '" & gblItemID & "'"
Loop WHILE not MyDetail.NoMatch
end if

end with

'close/release object variables
MyDetail.close
set MyDetail = nothing
set MyDB = nothing
'~~~~~~~~~~~~~~~~~~~~~~~~~~

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Rob Parker wrote:
> Well, even if that code is within a loop that you haven't shown, it will
> not work because you are always telling it to .FindFirst ;-)
>
> Your Dim and Set statements belong outside your loop, and you need to use a
> .FindNext within the loop. Something like:
>
> Dim MyDB As Database
> Dim MyDetail As DAO.Recordset 'disambiguate the recordset type
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> .MoveFirst
>
> Do While Not MyDetail.EOF
> .FindNext ("itemid = '" & gblItemID & "' ")
> With MyDetail
> .Edit
> !ItemStatus = "Received"
> !QuantityReceived = !QuantityOrdered
> .Update
> End With
> Loop
>
> Having said that, I'd actually build and execute an SQL string to do your
> update, as Crystal suggests. My reply is merely to assist you in
> understanding how to set up a loop that works ;-)
>
> HTH,
>
> Rob
>
>
> "Sharkbyte" wrote in message
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
>
>>The code below resides in a loop. It works fine, for the first record,
>>but
>>none of the others. The 'Findfirst' line searches for the proper ItemID,
>>however, it continues to attempt to update the first record of the table.
>>
>>Any suggestions on what I'm doing wrong?
>>
>>Thanks, in advance.
>>
>>Sharkbyte
>>
>>
>>Dim MyDB As Database
>>Dim MyDetail As Recordset
>>
>>Set MyDB = CurrentDb()
>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>
>>.MoveFirst
>>.FindFirst ("itemid = '" & gblItemID & "' ")
>>
>>With MyDetail
>> .Edit
>> !ItemStatus = "Received"
>> !QuantityReceived = !QuantityOrdered
>> .Update
>>End With

>
>
>

Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:13 AM
Rob Parker's Avatar Rob Parker
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst -- FindFirst before loop, FindNext in loop

Thanks for the minor amendments to my air-code example, Crystal.

Rob

"strive4peace" <"strive4peace2006 at yahoo dot com"> wrote in message
news:OkJHMjogGHA.3996@TK2MSFTNGP03.phx.gbl...
> Thanks, Rob
>
> It is a good idea to help Sharkbyte understand the logic errors instead of
> just suggesting a different method, thanks for that
>
> just have a couple comments on the code that Rob posted ...
>
> in case the FIRST record contains what is being sought... do .FindFirst
> before the loop (do not believe that .FindNext will stay on the same
> record...)
>
> Object variables need to be released when you are done with them
>
> '~~~~~~~~~~~~~~~~~~~~~~~~~~
> 'NEEDS REFERENCE TO
> 'Microsoft DAO Object Library
>
> Dim MyDB As DAO.Database
> Dim MyDetail As DAO.Recordset
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> With MyDetail
>
> .FindFirst "itemid = '" & gblItemID & "'"
>
> if not MyDetail.NoMatch then
> Do
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> .Edit
> !ItemStatus = "Received"
> !QuantityReceived = !QuantityOrdered
> .Update
> .FindNext "itemid = '" & gblItemID & "'"
> Loop WHILE not MyDetail.NoMatch
> end if
>
> end with
>
> 'close/release object variables
> MyDetail.close
> set MyDetail = nothing
> set MyDB = nothing
> '~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Warm Regards,
> Crystal
> Microsoft Access MVP 2006
>
> *
> Have an awesome day
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>
> remote programming and training
> strive4peace2006 at yahoo.com
>
> *
>
> Rob Parker wrote:
>> Well, even if that code is within a loop that you haven't shown, it will
>> not work because you are always telling it to .FindFirst ;-)
>>
>> Your Dim and Set statements belong outside your loop, and you need to use
>> a .FindNext within the loop. Something like:
>>
>> Dim MyDB As Database
>> Dim MyDetail As DAO.Recordset 'disambiguate the recordset type
>>
>> Set MyDB = CurrentDb()
>> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>
>> .MoveFirst
>>
>> Do While Not MyDetail.EOF
>> .FindNext ("itemid = '" & gblItemID & "' ")
>> With MyDetail
>> .Edit
>> !ItemStatus = "Received"
>> !QuantityReceived = !QuantityOrdered
>> .Update
>> End With
>> Loop
>>
>> Having said that, I'd actually build and execute an SQL string to do your
>> update, as Crystal suggests. My reply is merely to assist you in
>> understanding how to set up a loop that works ;-)
>>
>> HTH,
>>
>> Rob
>>
>>
>> "Sharkbyte" wrote in message
>> news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
>>
>>>The code below resides in a loop. It works fine, for the first record,
>>>but
>>>none of the others. The 'Findfirst' line searches for the proper ItemID,
>>>however, it continues to attempt to update the first record of the table.
>>>
>>>Any suggestions on what I'm doing wrong?
>>>
>>>Thanks, in advance.
>>>
>>>Sharkbyte
>>>
>>>
>>>Dim MyDB As Database
>>>Dim MyDetail As Recordset
>>>
>>>Set MyDB = CurrentDb()
>>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>>
>>>.MoveFirst
>>>.FindFirst ("itemid = '" & gblItemID & "' ")
>>>
>>>With MyDetail
>>> .Edit
>>> !ItemStatus = "Received"
>>> !QuantityReceived = !QuantityOrdered
>>> .Update
>>>End With

>>
>>


Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:13 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst

I actually began with an Update query. I went this way because I appeared to
be having problems with not being able to requery a subform because the
transaction hadn't completed.

But thanks for the help.

Sharkbyte


"strive4peace" <"strive4peace2006 at yaho" wrote:

> Hi Sharkbyte,
>
> Why not use an UPDATE query...
>
> '~~~~~~~~~~~~~~~~~~~~
> dim strSQL as string
> strSQL = "UPDATE tblpurchaseorderdetails " _
> & " SET ItemStatus = 'Received', " _
> & " QuantityReceived = nz(QuantityOrdered) " _
> & " WHERE itemid '" & gblItemID & "';"
> debug.print strSql
> currentdb.execute strSQL
> '~~~~~~~~~~~~~~~~~~~~
>
> ** debug.print ***
>
> debug.print strSQL
>
> --> this prints a copy of the SQL statement to the debug
> window (CTRL-G)
>
> After you execute your code, open the Debug window
> CTRL-G to Goto the debuG window -- look at the SQL statement
>
> If the SQL statement has an error
>
> 1. Make a new query (design view)
>
> 2. choose View, SQL from the menu
> (or SQL from the toolbar, first icon)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>
> 3. cut the SQL statement from the debug window
> (select, CTRL-X)
>
> 4. paste into the SQL window of the Query
> (CTRL-V)
>
> 5. run ! from the SQL window
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> -- Access will tell you where the problem is in the SQL
>
>
> Warm Regards,
> Crystal
> Microsoft Access MVP 2006
>
> *
> Have an awesome day
>
> remote programming and training
> strive4peace2006 at yahoo.com
>
> *
>
> Sharkbyte wrote:
> > The code below resides in a loop. It works fine, for the first record, but
> > none of the others. The 'Findfirst' line searches for the proper ItemID,
> > however, it continues to attempt to update the first record of the table.
> >
> > Any suggestions on what I'm doing wrong?
> >
> > Thanks, in advance.
> >
> > Sharkbyte
> >
> >
> > Dim MyDB As Database
> > Dim MyDetail As Recordset
> >
> > Set MyDB = CurrentDb()
> > Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
> >
> > .MoveFirst
> > .FindFirst ("itemid = '" & gblItemID & "' ")
> >
> > With MyDetail
> > .Edit
> > !ItemStatus = "Received"
> > !QuantityReceived = !QuantityOrdered
> > .Update
> > End With

>

Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:13 AM
Sharkbyte's Avatar Sharkbyte
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst

Thanks for the lesson. It was my first time using this method. I have gone
back to the Update query, but will keep your tips in mind.

Sharkbyte



"Rob Parker" wrote:

> Well, even if that code is within a loop that you haven't shown, it will
> not work because you are always telling it to .FindFirst ;-)
>
> Your Dim and Set statements belong outside your loop, and you need to use a
> ..FindNext within the loop. Something like:
>
> Dim MyDB As Database
> Dim MyDetail As DAO.Recordset 'disambiguate the recordset type
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> ..MoveFirst
>
> Do While Not MyDetail.EOF
> .FindNext ("itemid = '" & gblItemID & "' ")
> With MyDetail
> .Edit
> !ItemStatus = "Received"
> !QuantityReceived = !QuantityOrdered
> .Update
> End With
> Loop
>
> Having said that, I'd actually build and execute an SQL string to do your
> update, as Crystal suggests. My reply is merely to assist you in
> understanding how to set up a loop that works ;-)
>
> HTH,
>
> Rob
>
>
> "Sharkbyte" wrote in message
> news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
> > The code below resides in a loop. It works fine, for the first record,
> > but
> > none of the others. The 'Findfirst' line searches for the proper ItemID,
> > however, it continues to attempt to update the first record of the table.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> >
> > Any suggestions on what I'm doing wrong?
> >
> > Thanks, in advance.
> >
> > Sharkbyte
> >
> >
> > Dim MyDB As Database
> > Dim MyDetail As Recordset
> >
> > Set MyDB = CurrentDb()
> > Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
> >
> > .MoveFirst
> > .FindFirst ("itemid = '" & gblItemID & "' ")
> >
> > With MyDetail
> > .Edit
> > !ItemStatus = "Received"
> > !QuantityReceived = !QuantityOrdered
> > .Update
> > End With

>
>
>

Reply With Quote
  #8 (permalink)  
Old 28-Jul-2006, 08:13 AM
strive4peace's Avatar strive4peace
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst -- FindFirst before loop, FindNext inloop

Hi Rob,

you're welcome We are all in this together seeking a
common goal

glad you were not offended by my "air-comments"! I
appreciated your add-on to what I wrote and to help
Sharkbyte understand why his code didn't work. Have a safe
and happy holiday, Rob.

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Rob Parker wrote:
> Thanks for the minor amendments to my air-code example, Crystal.
>
> Rob
>
> "strive4peace" <"strive4peace2006 at yahoo dot com"> wrote in message
> news:OkJHMjogGHA.3996@TK2MSFTNGP03.phx.gbl...
>
>>Thanks, Rob
>>
>>It is a good idea to help Sharkbyte understand the logic errors instead of
>>just suggesting a different method, thanks for that
>>
>>just have a couple comments on the code that Rob posted ...
>>
>>in case the FIRST record contains what is being sought... do .FindFirst
>>before the loop (do not believe that .FindNext will stay on the same
>>record...)
>>
>>Object variables need to be released when you are done with them
>>
>>'~~~~~~~~~~~~~~~~~~~~~~~~~~
>>'NEEDS REFERENCE TO
>>'Microsoft DAO Object Library
>>
>>Dim MyDB As DAO.Database
>>Dim MyDetail As DAO.Recordset
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>
>>Set MyDB = CurrentDb()
>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>
>>With MyDetail
>>
>> .FindFirst "itemid = '" & gblItemID & "'"
>>
>> if not MyDetail.NoMatch then
>> Do
>> .Edit
>> !ItemStatus = "Received"
>> !QuantityReceived = !QuantityOrdered
>> .Update
>> .FindNext "itemid = '" & gblItemID & "'"
>> Loop WHILE not MyDetail.NoMatch
>> end if
>>
>>end with
>>
>>'close/release object variables
>>MyDetail.close
>>set MyDetail = nothing
>>set MyDB = nothing
>>'~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>Warm Regards,
>>Crystal
>>Microsoft Access MVP 2006
>>
>> *
>> Have an awesome day
>>
>> remote programming and training
>> strive4peace2006 at yahoo.com
>>
>> *
>>
>>Rob Parker wrote:
>>
>>>Well, even if that code is within a loop that you haven't shown, it will
>>>not work because you are always telling it to .FindFirst ;-)
>>>
>>>Your Dim and Set statements belong outside your loop, and you need to use
>>>a .FindNext within the loop. Something like:
>>>
>>>Dim MyDB As Database
>>>Dim MyDetail As DAO.Recordset 'disambiguate the recordset type
>>>
>>>Set MyDB = CurrentDb()
>>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>>
>>>.MoveFirst
>>>
>>>Do While Not MyDetail.EOF
>>> .FindNext ("itemid = '" & gblItemID & "' ")
>>> With MyDetail
>>> .Edit
>>> !ItemStatus = "Received"
>>> !QuantityReceived = !QuantityOrdered
>>> .Update
>>> End With
>>>Loop
>>>
>>>Having said that, I'd actually build and execute an SQL string to do your
>>>update, as Crystal suggests. My reply is merely to assist you in
>>>understanding how to set up a loop that works ;-)
>>>
>>>HTH,
>>>
>>>Rob
>>>
>>>
>>>"Sharkbyte" wrote in message
>>>news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
>>>
>>>
>>>>The code below resides in a loop. It works fine, for the first record,
>>>>but
>>>>none of the others. The 'Findfirst' line searches for the proper ItemID,
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>>>however, it continues to attempt to update the first record of the table.
>>>>
>>>>Any suggestions on what I'm doing wrong?
>>>>
>>>>Thanks, in advance.
>>>>
>>>>Sharkbyte
>>>>
>>>>
>>>>Dim MyDB As Database
>>>>Dim MyDetail As Recordset
>>>>
>>>>Set MyDB = CurrentDb()
>>>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>>>
>>>>.MoveFirst
>>>>.FindFirst ("itemid = '" & gblItemID & "' ")
>>>>
>>>>With MyDetail
>>>> .Edit
>>>> !ItemStatus = "Received"
>>>> !QuantityReceived = !QuantityOrdered
>>>> .Update
>>>>End With
>>>
>>>

>

Reply With Quote
  #9 (permalink)  
Old 28-Jul-2006, 08:13 AM
strive4peace's Avatar strive4peace
Guest
 
Posts: n/a
   
   
Re: Problems w/ FindFirst

  Donate Today!  
you welcome, Sharkbyte happy to help

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day

remote programming and training
strive4peace2006 at yahoo.com

*

Sharkbyte wrote:
> Thanks for the lesson. It was my first time using this method. I have gone
> back to the Update query, but will keep your tips in mind.
>
> Sharkbyte
>
>
>
> "Rob Parker" wrote:
>
>
>>Well, even if that code is within a loop that you haven't shown, it will
>>not work because you are always telling it to .FindFirst ;-)
>>
>>Your Dim and Set statements belong outside your loop, and you need to use a
>>..FindNext within the loop. Something like:
>>
>>Dim MyDB As Database
>>Dim MyDetail As DAO.Recordset 'disambiguate the recordset type
>>
>>Set MyDB = CurrentDb()
>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>>
>>..MoveFirst
>>
>>Do While Not MyDetail.EOF
>> .FindNext ("itemid = '" & gblItemID & "' ")
>> With MyDetail
>> .Edit
>> !ItemStatus = "Received"
>> !QuantityReceived = !QuantityOrdered
>> .Update
>> End With
>>Loop
>>
>>Having said that, I'd actually build and execute an SQL string to do your
>>update, as Crystal suggests. My reply is merely to assist you in
>>understanding how to set up a loop that works ;-)
>>
>>HTH,
>>
>>Rob
>>
>>
>>"Sharkbyte" wrote in message
>>news:EFA8EF96-1E17-46AF-A750-8D7ACA0B6199@microsoft.com...
>>
>>>The code below resides in a loop. It works fine, for the first record,
>>>but
>>>none of the others. The 'Findfirst' line searches for the proper ItemID,
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>>however, it continues to attempt to update the first record of the table.
>>>
>>>Any suggestions on what I'm doing wrong?
>>>
>>>Thanks, in advance.
>>>
>>>Sharkbyte
>>>
>>>
>>>Dim MyDB As Database
>>>Dim MyDetail As Recordset
>>>
>>>Set MyDB = CurrentDb()
>>>Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>>
>>>.MoveFirst
>>>.FindFirst ("itemid = '" & gblItemID & "' ")
>>>
>>>With MyDetail
>>> .Edit
>>> !ItemStatus = "Received"
>>> !QuantityReceived = !QuantityOrdered
>>> .Update
>>>End With

>>
>>
>>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Do you believe in...
Today 10:03 AM
168 Replies, 3,513 Views
Nitnem Gutka - Gurmukhi...
Today 08:09 AM
14 Replies, 16,373 Views
Map shows world's 'most...
Today 07:16 AM
13 Replies, 165 Views
Why are There so Many...
Today 06:19 AM
49 Replies, 4,807 Views
Learn Punjabi Yourself...
Today 05:41 AM
15 Replies, 7,609 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 05:32 AM
167 Replies, 4,291 Views
The Great Imp Debate
Today 05:28 AM
32 Replies, 483 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 05:16 AM
299 Replies, 7,379 Views
Textbooks Spotted...
Today 04:53 AM
5 Replies, 73 Views
BHOOTS (Ghosts) and...
Today 04:22 AM
92 Replies, 13,728 Views
Thought of the Moment!
Today 04:01 AM
105 Replies, 4,988 Views
Panjabi
Today 02:14 AM
9 Replies, 206 Views
Fresno Sikh Who Was...
Today 01:30 AM
0 Replies, 43 Views
Guns of the Nihangs...
Today 01:24 AM
0 Replies, 47 Views
Saudi Woman Makes...
Today 01:01 AM
0 Replies, 33 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 11:08 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.60871 seconds with 32 queries
0