Re: Opening a report with Last Record or New Record

Tech-Archive recommends: Fix windows errors by optimizing your registry



You can set the Default Value of the text box so it carries over the value
like this:
Carry current value of a control to new records
at:
http://www.mvps.org/access/forms/frm0012.htm

Alternatively, you can assign the value in the BeforeInsert event of the
form, copying it from OpenArgs if you put it there when you OpenForm.

You can assign it with:
Forms!Form1!DealerID = 999
but I don't like automatically dirtying the record like that if you can
avoid it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JeffH13" <jeffh13@xxxxxxx> wrote in message
news:2FC13874-0D51-44D7-84F9-0EE29030685B@xxxxxxxxxxxxxxxx
Ok, It creates a new record and wasn't really thinking about this but, I
need
the dealer number to carry over into that new record so I can place the
date
in the date field.

Does that make sense....

"Allen Browne" wrote:

How about filtering to today's records.
If there are none, you will be at the new record.

Private Sub Form_Open(Cancel As Integer)
Me.Filter = "[DealerDate] >= Date()"
Me.FilterOn = True
End Sub

--
"JeffH13" <jeffh13@xxxxxxx> wrote in message
news:E981A18E-9D74-4801-B50D-59FDF7681625@xxxxxxxxxxxxxxxx
I want to open this report with the last record if the last record has a
date
of today, if not, I want to open a new record.

I have a form that shows all the dealers. You select a command button
it
then opens a new form that currently shows the last record of that
dealer.

But I want to check on the second form when it opens if the date
doesn't
match todays date that it would create a new record for that dealer.

--
Private Sub Form_Open(Cancel As Integer)
If vbShort([DealerDate]) <Now() Then DoCmd.GoToRecord , , acNewRec
End Sub
---

I'm I way off... Thanks!!!!





.


Quantcast