'Plus One' Button on Form

  • Thread starter Thread starter becky250
  • Start date Start date
B

becky250

I am looking to create a database using Access 2003 that has a number of
forms each being a checklist. Against the list of headings I would like a box
with the number displayed that people could not edit but a button that added
one to the total in the box. Sort of like a tally system. Is this possible
and if so what is the possible way of doing it? Thanks
 
I am looking to create a database using Access 2003 that has a number of
forms each being a checklist. Against the list of headings I would like a box
with the number displayed that people could not edit but a button that added
one to the total in the box. Sort of like a tally system. Is this possible
and if so what is the possible way of doing it? Thanks

Tables are fundamental. Forms are derived.

You can't have "a total" in a Form and expect it to stay around. You can
*DISPLAY* a total of data stored in a table on a form... but it really sounds
like you're starting your database design by creating "a number of forms".
That's like building a house and putting up the window and doorframes and then
deciding where you'll pour the foundations!

See

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

Roger Carlson's tutorials, samples and tips:
http://www.rogersaccesslibrary.com/

A free tutorial written by Crystal:
http://allenbrowne.com/casu-22.html

A video how-to series by Crystal:
http://www.YouTube.com/user/LearnAccessByCrystal

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials

especially the tutorials. You'll be a lot better off if you get started on the
right path!
 
Hey John,

Dont get me wrong, of course there are tables in my DB and this is where all
the records/headings etc are stored but i need to be able to input the new
data via the form (i.e so it is easy/user-friendly) and hopefully through a
button of some sort so they can add as they go along (like click once, do
another task, click again). This information is obviously then all stored in
the tables. The reason I was concentrating more on the form side of things is
that i dont have much data to begin with in the tables aside from the
headings as the data needs to be inputted by the users (although I can use
fake numbers for testing). I was thinking of making a query for the 'plus
one' and then a macro to run the query when the button was pressed, but my
Access skills arent quite up to scratch.

Hope this provides a better explanation and thanks for the reply.
 
Hey John,

Dont get me wrong, of course there are tables in my DB and this is where all
the records/headings etc are stored but i need to be able to input the new
data via the form (i.e so it is easy/user-friendly) and hopefully through a
button of some sort so they can add as they go along (like click once, do
another task, click again). This information is obviously then all stored in
the tables. The reason I was concentrating more on the form side of things is
that i dont have much data to begin with in the tables aside from the
headings as the data needs to be inputted by the users (although I can use
fake numbers for testing). I was thinking of making a query for the 'plus
one' and then a macro to run the query when the button was pressed, but my
Access skills arent quite up to scratch.

Hope this provides a better explanation and thanks for the reply.

Not really!

What value do you want to increment? How does the user specify which record
contains that value? What is it incremented TO? If you're incrementing a
"total", is it really a total (which presumably is a sum of existing values
and therefore cannot/should not be editable)?
 
Im not sure what you are asking me now. I would just like a form that brings
up a new record whereby all the values are at 0 and then something to
potentially add one to the zero values (but like a counter so it would go,
click one: 1, click twice: 2). Sort of like =A2+1 on an Excel Spreadsheet. So
if it was:

Payment 0
Receipts 0
Rpays 0

and then something that could make those values potentially increase to
different values via a button for each heading.

Basically I have been asked to make a checklist which was originally
manually done into an easily accessible database in terms of adding and
storing the information. Furthermore something that is simple to work as most
users will not have used Access before. Also they need to be able to keep
Access open throughout the day and add to their record at different times. It
would just be one record per user per day.

Regards
 
Sorry, just an extra bit of info. As it stands i have the table that stores
the data and i have a simple form that i can add new records to for example:

Payments 5
Receipts 5 etc

This then saves automatically in the table. I am just looking for a way that
means they dont have to manually enter a total, like 5, but can add to it
throughout the day, adding one each time as they are meant to record their
actions as they go.
 
Sorry, just an extra bit of info. As it stands i have the table that stores
the data and i have a simple form that i can add new records to for example:

Payments 5
Receipts 5 etc

This then saves automatically in the table. I am just looking for a way that
means they dont have to manually enter a total, like 5, but can add to it
throughout the day, adding one each time as they are meant to record their
actions as they go.

I'm still not quite sure I understand, but you could put code in the button's
Click event:

Private Sub cmdAddOne_Click()
Me!textboxname = Me!textboxname + 1
End Sub

You might also consider putting the same code in the textbox's DoubleClick
event so the user could just mouse into a textbox, doubleclick (don't use
click, it's too easy to fire it unintentionally) and have it increment that
field.
 
Sorry, really silly question, where can i put this coding? I will try it out,
it sounds about right.
 
Sorry, really silly question, where can i put this coding? I will try it out,
it sounds about right.

Open the form in design view. Select (or create) the command button. View its
Properties; on the "Events" tab one of them is the Click event. Click the ...
icon by that property and choose "Code Builder". Access will open the VBA
editor and give you the appropriate Sub and End Sub lines for free. Just edit
the one line in between (using your actual control name of course).
 
This doesn't seem to be working though im not sure if ive edited it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though when the button
is clicked. I also tried it for the double click action on the textbox but
couldnt get this to work either. Would I need something which made all the
entries in a new record default to 0 so that the command could plus one to
that? Access is harder than it first appears!

Regards
 
That works absolutely brilliantly for the double click, thank you! Exactly
what i was looking for. The button however still doesnt work, this is what i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a 'Minus 1'
button just using - 1? Thanks again.
 
You sure that the Click event is firing? Is the Click property set to [Event
Procedure]?

If it is, put a message box inside the event to see whether it actually is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
That works absolutely brilliantly for the double click, thank you! Exactly
what i was looking for. The button however still doesnt work, this is what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a 'Minus
1'
button just using - 1? Thanks again.
 
Its definitely on "On Click: Event Procedure" for the button and I copied the
formaula exactly. Im not sure how to add a message box sorry, tried to Google
how to do this also to save you having to go through it but couldnt find an
answer.

Regards

Douglas J. Steele said:
You sure that the Click event is firing? Is the Click property set to [Event
Procedure]?

If it is, put a message box inside the event to see whether it actually is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
That works absolutely brilliantly for the double click, thank you! Exactly
what i was looking for. The button however still doesnt work, this is what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a 'Minus
1'
button just using - 1? Thanks again.
 
Is it maybe something to do with how the button is linked to the command? The
textbox commands seem directly linked i.e the command is preceded by the name
of the box but the button doesnt seem to be connected to the 'add one'
command.


becky250 said:
Its definitely on "On Click: Event Procedure" for the button and I copied the
formaula exactly. Im not sure how to add a message box sorry, tried to Google
how to do this also to save you having to go through it but couldnt find an
answer.

Regards

Douglas J. Steele said:
You sure that the Click event is firing? Is the Click property set to [Event
Procedure]?

If it is, put a message box inside the event to see whether it actually is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
That works absolutely brilliantly for the double click, thank you! Exactly
what i was looking for. The button however still doesnt work, this is what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a 'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive edited it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though when the
button
is clicked. I also tried it for the double click action on the textbox
but
couldnt get this to work either. Would I need something which made all
the
entries in a new record default to 0 so that the command could plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command button.
View
its
Properties; on the "Events" tab one of them is the Click event. Click
the
...
icon by that property and choose "Code Builder". Access will open the
VBA
editor and give you the appropriate Sub and End Sub lines for free.
Just
edit
the one line in between (using your actual control name of course).
 
You say you've got [Event Procedure] as the value for the On Click property.
If you click on the ellipsis (...) to the right of that, where in the VB
Editor are you taken?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Is it maybe something to do with how the button is linked to the command?
The
textbox commands seem directly linked i.e the command is preceded by the
name
of the box but the button doesnt seem to be connected to the 'add one'
command.


becky250 said:
Its definitely on "On Click: Event Procedure" for the button and I copied
the
formaula exactly. Im not sure how to add a message box sorry, tried to
Google
how to do this also to save you having to go through it but couldnt find
an
answer.

Regards

Douglas J. Steele said:
You sure that the Click event is firing? Is the Click property set to
[Event
Procedure]?

If it is, put a message box inside the event to see whether it actually
is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That works absolutely brilliantly for the double click, thank you!
Exactly
what i was looking for. The button however still doesnt work, this is
what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event
procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a
'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive edited
it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though when
the
button
is clicked. I also tried it for the double click action on the
textbox
but
couldnt get this to work either. Would I need something which made
all
the
entries in a new record default to 0 so that the command could
plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I
will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command
button.
View
its
Properties; on the "Events" tab one of them is the Click event.
Click
the
...
icon by that property and choose "Code Builder". Access will open
the
VBA
editor and give you the appropriate Sub and End Sub lines for
free.
Just
edit
the one line in between (using your actual control name of
course).
 
Yeah, it takes me to "TS Database - Form_Example of click on netting (Code)"
and the code/command is at the very top of the Page. There are properties on
the left hand side that say Plus 1 for Netting CommandButton and it shows
that on the 'OnClick' there is [Event Procedure]. The formula is still at:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

Thanks for your prompt responses.

Douglas J. Steele said:
You say you've got [Event Procedure] as the value for the On Click property.
If you click on the ellipsis (...) to the right of that, where in the VB
Editor are you taken?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Is it maybe something to do with how the button is linked to the command?
The
textbox commands seem directly linked i.e the command is preceded by the
name
of the box but the button doesnt seem to be connected to the 'add one'
command.


becky250 said:
Its definitely on "On Click: Event Procedure" for the button and I copied
the
formaula exactly. Im not sure how to add a message box sorry, tried to
Google
how to do this also to save you having to go through it but couldnt find
an
answer.

Regards

:

You sure that the Click event is firing? Is the Click property set to
[Event
Procedure]?

If it is, put a message box inside the event to see whether it actually
is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That works absolutely brilliantly for the double click, thank you!
Exactly
what i was looking for. The button however still doesnt work, this is
what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event
procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a
'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive edited
it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though when
the
button
is clicked. I also tried it for the double click action on the
textbox
but
couldnt get this to work either. Would I need something which made
all
the
entries in a new record default to 0 so that the command could
plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I
will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command
button.
View
its
Properties; on the "Events" tab one of them is the Click event.
Click
the
...
icon by that property and choose "Code Builder". Access will open
the
VBA
editor and give you the appropriate Sub and End Sub lines for
free.
Just
edit
the one line in between (using your actual control name of
course).
 
What I was looking for was when you click on the ellipsis, is the cursor in
the VB Editor inside of the block of code

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

or is it somewhere else? If it's not inside that block of code, is it inside
another block of code?

BTW, to add a message box, change what you've got to

Private Sub cmdAddOne_Click()

MsgBox "Inside of cmdAddOne_Click"
Me!Netting = Nz(Me!Netting, 0) + 1

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Yeah, it takes me to "TS Database - Form_Example of click on netting
(Code)"
and the code/command is at the very top of the Page. There are properties
on
the left hand side that say Plus 1 for Netting CommandButton and it shows
that on the 'OnClick' there is [Event Procedure]. The formula is still at:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

Thanks for your prompt responses.

Douglas J. Steele said:
You say you've got [Event Procedure] as the value for the On Click
property.
If you click on the ellipsis (...) to the right of that, where in the VB
Editor are you taken?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Is it maybe something to do with how the button is linked to the
command?
The
textbox commands seem directly linked i.e the command is preceded by
the
name
of the box but the button doesnt seem to be connected to the 'add one'
command.


:

Its definitely on "On Click: Event Procedure" for the button and I
copied
the
formaula exactly. Im not sure how to add a message box sorry, tried to
Google
how to do this also to save you having to go through it but couldnt
find
an
answer.

Regards

:

You sure that the Click event is firing? Is the Click property set
to
[Event
Procedure]?

If it is, put a message box inside the event to see whether it
actually
is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That works absolutely brilliantly for the double click, thank you!
Exactly
what i was looking for. The button however still doesnt work, this
is
what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event
procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a
'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive
edited
it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though
when
the
button
is clicked. I also tried it for the double click action on the
textbox
but
couldnt get this to work either. Would I need something which
made
all
the
entries in a new record default to 0 so that the command could
plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I
will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command
button.
View
its
Properties; on the "Events" tab one of them is the Click
event.
Click
the
...
icon by that property and choose "Code Builder". Access will
open
the
VBA
editor and give you the appropriate Sub and End Sub lines for
free.
Just
edit
the one line in between (using your actual control name of
course).
 
Thank you so much!! I copied the formula into where on the block of code it
took me (which was a different place to where the original formula was) and
it now works! This is exactly what I wanted and I would never have been able
to do this on my own so thank you for your time and patience!


Douglas J. Steele said:
What I was looking for was when you click on the ellipsis, is the cursor in
the VB Editor inside of the block of code

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

or is it somewhere else? If it's not inside that block of code, is it inside
another block of code?

BTW, to add a message box, change what you've got to

Private Sub cmdAddOne_Click()

MsgBox "Inside of cmdAddOne_Click"
Me!Netting = Nz(Me!Netting, 0) + 1

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Yeah, it takes me to "TS Database - Form_Example of click on netting
(Code)"
and the code/command is at the very top of the Page. There are properties
on
the left hand side that say Plus 1 for Netting CommandButton and it shows
that on the 'OnClick' there is [Event Procedure]. The formula is still at:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

Thanks for your prompt responses.

Douglas J. Steele said:
You say you've got [Event Procedure] as the value for the On Click
property.
If you click on the ellipsis (...) to the right of that, where in the VB
Editor are you taken?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Is it maybe something to do with how the button is linked to the
command?
The
textbox commands seem directly linked i.e the command is preceded by
the
name
of the box but the button doesnt seem to be connected to the 'add one'
command.


:

Its definitely on "On Click: Event Procedure" for the button and I
copied
the
formaula exactly. Im not sure how to add a message box sorry, tried to
Google
how to do this also to save you having to go through it but couldnt
find
an
answer.

Regards

:

You sure that the Click event is firing? Is the Click property set
to
[Event
Procedure]?

If it is, put a message box inside the event to see whether it
actually
is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That works absolutely brilliantly for the double click, thank you!
Exactly
what i was looking for. The button however still doesnt work, this
is
what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event
procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a
'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive
edited
it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though
when
the
button
is clicked. I also tried it for the double click action on the
textbox
but
couldnt get this to work either. Would I need something which
made
all
the
entries in a new record default to 0 so that the command could
plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I
will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command
button.
View
its
Properties; on the "Events" tab one of them is the Click
event.
Click
the
...
icon by that property and choose "Code Builder". Access will
open
the
VBA
editor and give you the appropriate Sub and End Sub lines for
free.
Just
edit
the one line in between (using your actual control name of
course).
 
To anyone that is reading this looking for an answer to their own question,
this code works brilliantly well for 'Minus One' also simply by replacing the
'+' with '-'.

Thanks again!



becky250 said:
Thank you so much!! I copied the formula into where on the block of code it
took me (which was a different place to where the original formula was) and
it now works! This is exactly what I wanted and I would never have been able
to do this on my own so thank you for your time and patience!


Douglas J. Steele said:
What I was looking for was when you click on the ellipsis, is the cursor in
the VB Editor inside of the block of code

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

or is it somewhere else? If it's not inside that block of code, is it inside
another block of code?

BTW, to add a message box, change what you've got to

Private Sub cmdAddOne_Click()

MsgBox "Inside of cmdAddOne_Click"
Me!Netting = Nz(Me!Netting, 0) + 1

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


becky250 said:
Yeah, it takes me to "TS Database - Form_Example of click on netting
(Code)"
and the code/command is at the very top of the Page. There are properties
on
the left hand side that say Plus 1 for Netting CommandButton and it shows
that on the 'OnClick' there is [Event Procedure]. The formula is still at:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub

Thanks for your prompt responses.

:

You say you've got [Event Procedure] as the value for the On Click
property.
If you click on the ellipsis (...) to the right of that, where in the VB
Editor are you taken?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Is it maybe something to do with how the button is linked to the
command?
The
textbox commands seem directly linked i.e the command is preceded by
the
name
of the box but the button doesnt seem to be connected to the 'add one'
command.


:

Its definitely on "On Click: Event Procedure" for the button and I
copied
the
formaula exactly. Im not sure how to add a message box sorry, tried to
Google
how to do this also to save you having to go through it but couldnt
find
an
answer.

Regards

:

You sure that the Click event is firing? Is the Click property set
to
[Event
Procedure]?

If it is, put a message box inside the event to see whether it
actually
is
firing.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


That works absolutely brilliantly for the double click, thank you!
Exactly
what i was looking for. The button however still doesnt work, this
is
what
i
have:


Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub (this is set to a command button, in a the click event
procedure,
code builder etc)


Private Sub Netting_DblClick(Cancel As Integer)

Me!Netting = Nz(Me!Netting, 0) + 1


End Sub (this is set to the textbox 'Netting')

Is there anything im missing? Also, would it be possible to have a
'Minus
1'
button just using - 1? Thanks again.


:

Private Sub cmdAddOne_Click()

Me!Netting = Nz(Me!Netting, 0) + 1

End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


This doesn't seem to be working though im not sure if ive
edited
it
correctly. I have

Private Sub cmdAddOne_Click()
Me!Netting = Me!Netting + 1

End Sub

where the text box is called Netting. Nothing happens though
when
the
button
is clicked. I also tried it for the double click action on the
textbox
but
couldnt get this to work either. Would I need something which
made
all
the
entries in a new record default to 0 so that the command could
plus one
to
that? Access is harder than it first appears!

Regards


:

On Fri, 19 Jun 2009 09:21:03 -0700, becky250

Sorry, really silly question, where can i put this coding? I
will try
it
out,
it sounds about right.

Open the form in design view. Select (or create) the command
button.
View
its
Properties; on the "Events" tab one of them is the Click
event.
Click
the
...
icon by that property and choose "Code Builder". Access will
open
the
VBA
editor and give you the appropriate Sub and End Sub lines for
free.
Just
edit
the one line in between (using your actual control name of
course).
 
Back
Top