Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Error with form.requery (no current record)

Geek News

Error with form.requery (no current record)
h3llz 12/10/2008 8:37:03 PM
I want to dump all information within the table and requery the form, and i
get error no current record, please help! :)

.MoveLast
.MoveFirst
I = 1
Do While I <= .RecordCount
basketID = QryDat.Fields.Item("basketID")
productID = QryDat.Fields.Item("productID")
subtotal = QryDat.Fields.Item("subtotal")
quantity = QryDat.Fields.Item("quantity")
DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
(basketID,productID,subtotal,quantity);")
.MoveNext
I = (I + 1)
Loop
'DoCmd.OpenReport "invoice", acPreview
DoCmd.RunSQL ("UPDATE tblBasketContent SET deleted=True;")
DoCmd.RunSQL ("INSERT INTO tblBaskets (total) VALUES ('0');")
Form.Requery
Re: Error with form.requery (no current record)
"Paul Shapiro" <paul[ at ]hideme.broadwayData.com> 12/11/2008 1:50:31 AM
You didn't say which line of code is causing the error, but I would replace
the Do While I <= .Recordcount
with Do While Not .eof.
Do While Not .eof
basketID = QryDat.Fields.Item("basketID")
productID = QryDat.Fields.Item("productID")
subtotal = QryDat.Fields.Item("subtotal")
quantity = QryDat.Fields.Item("quantity")
DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
(basketID,productID,subtotal,quantity);")
.MoveNext
Loop

Better still would be replacing the procedural code that looks through the
recordset with an append query that just copies the data set from the source
to the destination.

"h3llz" <h3llz[ at ]discussions.microsoft.com> wrote in message
news:09C1419E-74FB-4D68-8E5E-E7CC97C5A2FA[ at ]microsoft.com...
[Quoted Text]
>I want to dump all information within the table and requery the form, and i
> get error no current record, please help! :)
>
> .MoveLast
> .MoveFirst
> I = 1
> Do While I <= .RecordCount
> basketID = QryDat.Fields.Item("basketID")
> productID = QryDat.Fields.Item("productID")
> subtotal = QryDat.Fields.Item("subtotal")
> quantity = QryDat.Fields.Item("quantity")
> DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
> (basketID,productID,subtotal,quantity);")
> .MoveNext
> I = (I + 1)
> Loop
> 'DoCmd.OpenReport "invoice", acPreview
> DoCmd.RunSQL ("UPDATE tblBasketContent SET deleted=True;")
> DoCmd.RunSQL ("INSERT INTO tblBaskets (total) VALUES ('0');")
> Form.Requery

Re: Error with form.requery (no current record)
h3llz 12/11/2008 9:30:03 AM
The Form.Requery is causing the error because it went from records within the
table to none.

"Paul Shapiro" wrote:

[Quoted Text]
> You didn't say which line of code is causing the error, but I would replace
> the Do While I <= .Recordcount
> with Do While Not .eof.
> Do While Not .eof
> basketID = QryDat.Fields.Item("basketID")
> productID = QryDat.Fields.Item("productID")
> subtotal = QryDat.Fields.Item("subtotal")
> quantity = QryDat.Fields.Item("quantity")
> DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
> (basketID,productID,subtotal,quantity);")
> .MoveNext
> Loop
>
> Better still would be replacing the procedural code that looks through the
> recordset with an append query that just copies the data set from the source
> to the destination.
>
> "h3llz" <h3llz[ at ]discussions.microsoft.com> wrote in message
> news:09C1419E-74FB-4D68-8E5E-E7CC97C5A2FA[ at ]microsoft.com...
> >I want to dump all information within the table and requery the form, and i
> > get error no current record, please help! :)
> >
> > .MoveLast
> > .MoveFirst
> > I = 1
> > Do While I <= .RecordCount
> > basketID = QryDat.Fields.Item("basketID")
> > productID = QryDat.Fields.Item("productID")
> > subtotal = QryDat.Fields.Item("subtotal")
> > quantity = QryDat.Fields.Item("quantity")
> > DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
> > (basketID,productID,subtotal,quantity);")
> > .MoveNext
> > I = (I + 1)
> > Loop
> > 'DoCmd.OpenReport "invoice", acPreview
> > DoCmd.RunSQL ("UPDATE tblBasketContent SET deleted=True;")
> > DoCmd.RunSQL ("INSERT INTO tblBaskets (total) VALUES ('0');")
> > Form.Requery
>
>
Re: Error with form.requery (no current record)
"Paul Shapiro" <paul[ at ]hideme.broadwayData.com> 12/11/2008 2:20:23 PM
I'm not sure what your Form variable is set to? I assume this is a parameter
being passed into a subroutine? If not, and the code is running in the form
you are requerying, the syntax would be Me.Requery. Form seems a
questionable choice for a variable name since it's a reserved word. Maybe
try changing that to frmTemp, or frm, or something else.There's nothing
wrong with requerying a form that doesn't have data.

Did you step through the code with the debugger? An error for No Current
Record sounds more like an issue with a recordset operation, for example,
..MoveLast/.MoveFirst/.Fields when there aren't any records or the recordset
is positioned to .bof or .eof.

"h3llz" <h3llz[ at ]discussions.microsoft.com> wrote in message
news:B0972336-EDB7-4265-9BBE-ACA003E318EC[ at ]microsoft.com...
[Quoted Text]
> The Form.Requery is causing the error because it went from records within
> the
> table to none.
>
> "Paul Shapiro" wrote:
>
>> You didn't say which line of code is causing the error, but I would
>> replace
>> the Do While I <= .Recordcount
>> with Do While Not .eof.
>> Do While Not .eof
>> basketID = QryDat.Fields.Item("basketID")
>> productID = QryDat.Fields.Item("productID")
>> subtotal = QryDat.Fields.Item("subtotal")
>> quantity = QryDat.Fields.Item("quantity")
>> DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
>> (basketID,productID,subtotal,quantity);")
>> .MoveNext
>> Loop
>>
>> Better still would be replacing the procedural code that looks through
>> the
>> recordset with an append query that just copies the data set from the
>> source
>> to the destination.
>>
>> "h3llz" <h3llz[ at ]discussions.microsoft.com> wrote in message
>> news:09C1419E-74FB-4D68-8E5E-E7CC97C5A2FA[ at ]microsoft.com...
>> >I want to dump all information within the table and requery the form,
>> >and i
>> > get error no current record, please help! :)
>> >
>> > .MoveLast
>> > .MoveFirst
>> > I = 1
>> > Do While I <= .RecordCount
>> > basketID = QryDat.Fields.Item("basketID")
>> > productID = QryDat.Fields.Item("productID")
>> > subtotal = QryDat.Fields.Item("subtotal")
>> > quantity = QryDat.Fields.Item("quantity")
>> > DoCmd.RunSQL ("INSERT INTO tblBasketsContent VALUES
>> > (basketID,productID,subtotal,quantity);")
>> > .MoveNext
>> > I = (I + 1)
>> > Loop
>> > 'DoCmd.OpenReport "invoice", acPreview
>> > DoCmd.RunSQL ("UPDATE tblBasketContent SET deleted=True;")
>> > DoCmd.RunSQL ("INSERT INTO tblBaskets (total) VALUES ('0');")
>> > Form.Requery

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net