docmd.gotorecord on sub sub form

G

Guest

Thanks for taking the time to read my question.

I have a form that has a sub form which has a sub form. (3 deep). The sub
sub form is frmtblTime. I enter the start and end times of an event here.
On the main form, frmtblInvoice, I have a text box that I'd like to update
after the times have been entered, to show total time applied to task. The
task is tracked in frmtblInvoiceDetails

frmtblInvoice
frmtblInvoiceDetail
frmtblTime
many time records for one invoice detail record, and many invoice detail
records for one invoice record.

On my afterupdate event of starttime and endtime on frmtblTime I do a
requery of the text box that has the total time in it. When I do that,
frmtblTime goes back to the first record. I don't want it to change records,
but don't know how to stop it, so I thought I'd just make it move back to the
record I just left. So I made a recordset of the data with a query filtered
on the tableID of tblInvoiceDetail, and I loop through until my tableID,
which I saved before the requery, matches the tableID in the recordset and I
count the loops. This all works well, but when I try to apply my value to the
docmd.gotorecord function as seen here

(RecNum is where I store the count value)

docmd.gotorecord acDataForm,
"Forms!frmtblInvoice!frmtblInvoiceDetail!frmtblTime", acGoTo, RecNum

RecNum is where I store the count value.

I get the error:

frmtblTime is not open.

What can I do to solve my problem?

Thanks,

Brad
 
S

Shiller

Thanks for taking the time to read my question.

I have a form that has a sub form which has a sub form. (3 deep). The sub
sub form is frmtblTime. I enter the start and end times of an event here.
On the main form, frmtblInvoice, I have a text box that I'd like to update
after the times have been entered, to show total time applied to task. The
task is tracked in frmtblInvoiceDetails

frmtblInvoice
frmtblInvoiceDetail
frmtblTime
many time records for one invoice detail record, and many invoice detail
records for one invoice record.

On my afterupdate event of starttime and endtime on frmtblTime I do a
requery of the text box that has the total time in it. When I do that,
frmtblTime goes back to the first record. I don't want it to change records,
but don't know how to stop it, so I thought I'd just make it move back to the
record I just left. So I made a recordset of the data with a query filtered
on the tableID of tblInvoiceDetail, and I loop through until my tableID,
which I saved before the requery, matches the tableID in the recordset and I
count the loops. This all works well, but when I try to apply my value to the
docmd.gotorecord function as seen here

(RecNum is where I store the count value)

docmd.gotorecord acDataForm,
"Forms!frmtblInvoice!frmtblInvoiceDetail!frmtblTime", acGoTo, RecNum

RecNum is where I store the count value.

I get the error:

frmtblTime is not open.

What can I do to solve my problem?

Thanks,

Brad

Brad,

Try this:

DoCmd.OpenForm frmtblTime

DoCmd.GoToRecord acDataForm,
"Forms!frmtblInvoice!frmtblInvoiceDetail!frmtblTime", acGoTo, RecNum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top