open form at correct record

paulevans

Registered User.
Local time
Today, 15:50
Joined
Mar 7, 2006
Messages
79
Hi I am creating an invoice database.

In its simplist form I have three forms, which are tied to tables customers and invoices
and as such form:
1) Contains Basic client information
2) Contains info on invoices.
3) contains info of invoices.

the table are linked by a record id called [who]
and the invoices by one called [invocenum]

I have two forms for invoces because for the first invoce I do not need to show information about previous invoices whereas for any invoce creater than 2 I need to showinfo from the previous invoice.


The problem I have is that I want to beable to open my invoices to the last invoice created.This works fine for invoice 1,2 and 3. However for some reason my form always opens to invoice number 3 when the value goes above
3. and the record controls at the bottom of the form show that invoce 3 is infact the last record where invoice 4 is at record location 3.

i use the command

DoCmd.GoToRecord , , acLast

Any Ideas to this?

Thanks in advance
Paul
 
Ok so ita appears that access does not always save records in a logical order.

This would explain why my record three is infact record five.

So I think I need to use the docmd.findrecord command.

only I am havng problems with this to.
I use the following to open the newform

stDocName = "newinvoice"
stLinkCriteria = "[who]=" & Me![id]
DoCmd.Openform stDocName, , , stLinkCriteria

[forms]![newinvoice]![id].setfocus
docmd.findrecord x

where x is the number of the invoice.

I get an error message for this say can not set focus to this object.

Any one any Ideas
 

Users who are viewing this thread

Back
Top Bottom