Solved

VB and Access Table

Posted on 2000-04-04
3
174 Views
Last Modified: 2010-05-03
New to VB and I want to edit an Access
table in the database. When a form opens I want set an entire field (a check box) to false.
The db name: NTK_Memebers.mdb
The table name: Kart_Driver_Data
The field name: Enter_Race

I don't have a clue where to start.
Any help would be appreciated!
Thanks, Bob Schabel
0
Comment
Question by:bob_schabel
3 Comments
 
LVL 1

Expert Comment

by:riduce
ID: 2685520
An Example

Project > Components > Mark : Data grid control 6.0


add an datgrid to you're form set the property datasourse = data1
add data1 to you're form type by the property recordsource          Kart_Driver_Data


Private Sub Form_Load()
data1.databasename = "Kart_Driver_Data"
data1.Refresh
End Sub



0
 
LVL 6

Expert Comment

by:Marine
ID: 2685543
Make the Field to be Yes/No type.

Then for whatever number of records you have set it to false. I think this will do it.
Dim cn as New AdoDb.Connection
I assume that the connection is properly opened. Then do this.
sSql = "UPDATE Kart_Driver_Data SET Enter_Race = false WHERE Enter_Race=True"
cn.Execute sSql,iCount
cn.close
0
 
LVL 3

Accepted Solution

by:
Elmo_ earned 50 total points
ID: 2685787
Here is the answer ya need.

Declare these three variables, If they do not appear you will have to add in the data
control component or reference file, (In the project menu)

Dim WS1 As Workspace
Dim Datab As Database
Dim RecSet As Recordset

Dim DBName As String

'Put the database in the same directory as the project file (Or give the full path)
DBName = App.Path & "\NTK_Memebers.mdb"

'This sets up a workspace then creates a database within the workspace and then opens up a
'recordset within the database.  The record set is connected to your table

Set WS1 = DBEngine.CreateWorkspace("dbTemp", "admin", "")
Set Datab = WS1.OpenDatabase(DBName)
Set RecSet = Datab.OpenRecordset(Kart_Driver_Data, dbOpenDynaset)

'you can use recset.movefirst, recset.movenext , recset.moveprevious, recset.movelast to
'scroll through these recs.  
with recset
      .edit
      .Fields("Enter_Race") = 1
      .update
      .Bookmark = .LastModified
end with

Any problems leave a message.

Elmo_
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now