Sign Up |  Live StatsLive Stats    Articles 35,345| Comments 159,788| Members 17,820, Newest waheguruhelpme| Online 188
Home Contact
 (Forgotten?): 
    Sikhism

   
                                                                     Your Banner Here!    

Problems w/ FindFirst

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 400 USD, Received: 35 USD (9%)
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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10442-problems-w-findfirst.html
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



 
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
'~~~~~~~~~~~~~~~~~~~~

** debug.print ***

debug.print strSQL
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442

--> 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
-- 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")
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
  #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
..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")
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442

..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
>
> Set MyDB = CurrentDb()
> Set MyDetail = MyDB.OpenRecordset("tblpurchaseorderdetails")
>
> .MoveFirst
>
> Do While Not MyDetail.EOF
> .FindNext ("itemid = '" & gblItemID & "' ")
> With MyDetail
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> .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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>
>>
>>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
> .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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> 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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
> 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
> -- Access will tell you where the problem is in the SQL
>
>
> 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
>
> *
>
> 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
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
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,
> > 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

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>
>
>

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
>>
>>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 ;-)
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>>
>>>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
  #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
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...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10442
>>
>>>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
   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

» Gurbani Jukebox
Listen to Gurbani while surfing SPN!
» Active Discussions
sikhism Who is "Mohan"?
Today 06:52 AM
21 Replies, 315 Views
sikhism need urgent advice.......
Today 06:46 AM
6 Replies, 69 Views
sikhism ਨਾਮਾ
Today 06:37 AM
2 Replies, 43 Views
sikhism Sikh Diamonds Video...
Today 04:23 AM
6 Replies, 112 Views
sikhism Are Creator and Creation...
Today 01:30 AM
44 Replies, 2,829 Views
sikhism Herman Hesse,...
Today 00:54 AM
13 Replies, 225 Views
sikhism On a Scale of Most...
Yesterday 21:42 PM
30 Replies, 1,271 Views
sikhism I became victim by...
Yesterday 19:50 PM
0 Replies, 39 Views
sikhism How important is Matha...
By Ishna
Yesterday 19:05 PM
58 Replies, 1,025 Views
sikhism Sikh Books downloads
Yesterday 15:39 PM
2 Replies, 62 Views
sikhism Salok Sheikh Farid ji...
Yesterday 09:35 AM
0 Replies, 42 Views
sikhism In Punjab, three farmers...
Yesterday 05:36 AM
0 Replies, 45 Views
sikhism Supernatural Sikhs, what...
Yesterday 03:45 AM
19 Replies, 408 Views
sikhism Sukhmani Sahib Astpadi...
26-May-2012 22:57 PM
0 Replies, 46 Views
Do You Think You Are...
26-May-2012 09:59 AM
94 Replies, 8,258 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.2

All times are GMT +6.5. The time now is 06:54 AM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.62844 seconds with 30 queries