Solved

VB and Access Table

Posted on 2000-04-04
3
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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