Please Help! to reduce data repeation

L

lasithakamalpriya

In a access form when I enter data Just like this

Date Invoice No
Product Price
02/11/2007 015 Tea
Packet 15$
02/11/2007 016
Toffee 1$
02/11/2007 017 Rice
Packet 30$

I have to enter the date one record by one record it is wasting the
time
So please tell me how I can reduce this matter like this
____________________________________________
Date 02/11/2007
____________________________________________
Invoice No Product Price
015 Tea Packet 15$
016 Toffee 1$
017 Rice Packet 30$

So here if it is form I have to enter the date one time. Please tell
me how I want to prepare the table, quries & form.
 
M

Marshall Barton

In a access form when I enter data Just like this

Date Invoice No
Product Price
02/11/2007 015 Tea
Packet 15$
02/11/2007 016
Toffee 1$
02/11/2007 017 Rice
Packet 30$

I have to enter the date one record by one record it is wasting the
time
So please tell me how I can reduce this matter like this
____________________________________________
Date 02/11/2007
____________________________________________
Invoice No Product Price
015 Tea Packet 15$
016 Toffee 1$
017 Rice Packet 30$

So here if it is form I have to enter the date one time. Please tell
me how I want to prepare the table, quries & form.


If you always want todays date, then just set the table
field's DefaultValue to Date()

If you want to be able to enter any date and have the next
several records use the same date, then you need to use a
form with a little code in the date text box's AfterUpdate
event procedure:

Me.txt.datetextbox = Format(Me.datetextbox, "\#yyyy-m-d\#")

This way anytime you want to enter a different date, just
type into the text box and then the new date will be used
until you type anoterh date.
 
L

Linq Adams via AccessMonster.com

In your form, you can use the AfterUpdate event of the control holding your
date to set the DefaultValue for the field. From that time forward, until you
either manually change the date or close your form, the date will be entered
automatically in each new record.

You need to replace

YourDateControlName

with the actual name of your control where you enter your date.

From Design View for you form, goto Properties - Events

Click to the right of the AfterUpdate property box

An Ellipse (...) should appear

Click on the Ellipse

Click on Code Builder

You should be taken into the code editor, near or in an empty sub like this

Private Sub YourDateControlName_AfterUpdate()

End Sub

Add this code

If Not IsNull(Me.YourDateControlName.Value) Then
YourDateControlName.DefaultValue ="#" & Me.YourDateControlName & "#"
End If

so that you end up with

Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
YourDateControlName.DefaultValue ="#" & Me.YourDateControlName & "#"
End If
End Sub

and you're set!

You can do the same thing for Text fields or Numeric fields, with only a
slight modification of the code:

For Text fields

Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value &
""""
End If
End Sub

For Numeric fields

Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub
 
L

lasithakamalpriya

In your form, you can use the AfterUpdate event of the control holding your
date to set the DefaultValue for the field. From that time forward, until you
either manually change the date or close your form, the date will be entered
automatically in each new record.

You need to replace

YourDateControlName

with the actual name of your control where you enter your date.

From Design View for you form, goto Properties - Events

Click to the right of the AfterUpdate property box

An Ellipse (...) should appear

Click on the Ellipse

Click on Code Builder

You should be taken into the code editor, near or in an empty sub like this

Private Sub YourDateControlName_AfterUpdate()

End Sub

Add this code

If Not IsNull(Me.YourDateControlName.Value) Then
YourDateControlName.DefaultValue ="#" & Me.YourDateControlName & "#"
End If

so that you end up with

Private Sub YourDateControlName_AfterUpdate()
If Not IsNull(Me.YourDateControlName.Value) Then
YourDateControlName.DefaultValue ="#" & Me.YourDateControlName & "#"
End If
End Sub

and you're set!

You can do the same thing for Text fields or Numeric fields, with only a
slight modification of the code:

For Text fields

Private Sub YourTextControlName_AfterUpdate()
If Not IsNull(Me.YourTextControlName.Value) Then
YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value &
""""
End If
End Sub

For Numeric fields

Private Sub YourNumericControlName_AfterUpdate()
If Not IsNull(Me.YourNumericControlName.Value) Then
YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted viahttp://www.accessmonster.com

Thank you sir for giving me the Best Answer regarding that matter from
which suffer for two years without any answer
 
L

lasithakamalpriya

In a access form when I enter data Just like this
Date Invoice No
Product Price
02/11/2007 015 Tea
Packet 15$
02/11/2007 016
Toffee 1$
02/11/2007 017 Rice
Packet 30$
I have to enter the date one record by one record it is wasting the
time
So please tell me how I can reduce this matter like this
____________________________________________
Date 02/11/2007
____________________________________________
Invoice No Product Price
015 Tea Packet 15$
016 Toffee 1$
017 Rice Packet 30$
So here if it is form I have to enter the date one time. Please tell
me how I want to prepare the table, quries & form.

If you always want todays date, then just set the table
field's DefaultValue to Date()

If you want to be able to enter any date and have the next
several records use the same date, then you need to use a
form with a little code in the date text box's AfterUpdate
event procedure:

Me.txt.datetextbox = Format(Me.datetextbox, "\#yyyy-m-d\#")

This way anytime you want to enter a different date, just
type into the text box and then the new date will be used
until you type anoterh date.

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -

Thank you Mr.Marsh giving me fullest cooperation
 

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