Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Giving Field a Value

Status
Not open for further replies.

lilx

Programmer
Aug 17, 2007
2
NL
hello,

i have made a very simple access form which works fine but i have a little part that counts op some value's dat works fine to

but when i press the button to make a new the counting value's are taking from the other one, so my question is is there a possible way to code in vb the make a vieldname value 1

example field "test123" = 0
 
I'm not entirely clear on what you are trying to achieve but it sounds like you want to increment the value in the field by 1 for every record added to the table.

If this is correct then you may want to look at making the field's data type "AutoNumber" in the table design.

Ed Metcalfe.

Please do not feed the trolls.....
 
I haven't much of a clue what your question is.

Try proofreading your post and pretend you are somebody who has never seen your application before, and ask yourself if there is enough information for another programmer to reconstruct your application.

 
ok i am not that good in english but what i tryin to explain is

1. i have a from
2. in that form i have a textfrom
3. one of them must count he value of a couple of others textform
1.JPG

4. in that textform i have this code "=Som([Maandag Avond])+([Dinsdag Avond])+([Woensdag Avond])+([Donderdag Avond])+([Vrijdag Avond])+([Zaterdag Avond])" (see picture 1)
5.it works fine no probleem with that code (see picture 2)
6. but i want to add new data (see picture 2)
2.JPG

7. the textform wich counts the amount has value of 1 instead of 0 ( see picture 3 )
3.JPG

8. so my qeustion is, isent there a way to pogram when i press the enter new data button, it makes my counting textfrom value 0

i am very sorry if it is hard to understand but i am not that good at english
 
Hello:

If this control has a field from your table bound to it, you can go to your table design and select the field that holds this entry and in the Field Properties section put:

the value of zero. Then each time you make a new record, this control will have zero

Regards
Mark
 
Hello again:

One other way, If this is a calculated control, because its is inefficient to store calculated values, you can use the NewRecord property to zero out your control when a new record is added. Enclosed below is the explanation from the help section of Access
Regards
Mark

NewRecord Property
See AlsoApplies ToExampleSpecificsYou can use the NewRecord property to determine whether the current record is a new record. Read-only Integer.

expression.NewRecord
expression Required. An expression that returns one of the objects in the Applies To list.

Remarks
The NewRecord property uses the following settings.

Setting Description
True The current record is new.
False The current record isn't new.


Note The NewRecord property is read-only in Form view and Datasheet view. It isn't available in Design view. This property is available only by using a macro or Visual Basic.

When a user has moved to a new record, the NewRecord property setting will be True whether the user has started to edit the record or not.

Example
The following example shows how to use the NewRecord property to determine if the current record is a new record. The NewRecordMark procedure sets the current record to the variable intnewrec. If the record is new, a message is displayed notifying the user of this. You could run this procedure when the Current event for a form occurs.

Sub NewRecordMark(frm As Form)
Dim intnewrec As Integer

intnewrec = frm.NewRecord
If intnewrec = True Then
MsgBox "You're in a new record." _
& "@Do you want to add new data?" _
& "@If not, move to an existing record."
End If
End Sub

 
Hey lilx,
I see you talk dutch. Since i'm from Belgium, I can maybe help you if you still have problems. If so, post here in dutch and i'll answer you in Dutch. I hope this is allowed though...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top