hi;
I need help .now am using vb6
how to icrement values in database(ms acesss).
if user click the check box then
authomatically increment the database value 1 to 2
how it is posible.pls give a sutable solution

Recommended Answers

All 5 Replies

hi, you have two set one of the field to autonumber. then your checkbox, you need to make a code for that the when the user clicks on it, it will add record to the database.

search google on how to do it like: "msaccess vb6 tutorial" or try this link: http://www.profsr.com/vb/vbintro.htm

Under the checkbox do the following -

Dim xRecCount As Integer

xRecCount = rsData.RecordCount

xRecData = xRecData + 1

Can you show us your codes? Passing value from VB6 to MSAccess will not work unless you have correct connection strings etc. If you have connected VB6 to Access correctly then it will be easy to pass values to database.
Thanks

iam connecting vb to ms access is throught connection.not code

Snairsumith, have a look at what I have posted above. Under say a command button click event add the code as follow -

Command1_Click ()
Dim xRecCount As Integer
 
xRecCount = rsData.RecordCount
 
xRecData = xRecData + 1

Data1!MyIdField = xRecData
'Other data to be added code here

Data1.Update

This is assuming that you are asking for an increment on the next data record to be added...?

Id you only want to change a value in a field where the value is currently 1, then do the following -

Dim xChange As Integer

xChange = Data1!MyFieldToChangeValue

xChange = xChange + 1

Data1!MyFieldToChange = xChange

Data1.Update

Did this answer your question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.