Solved

VB and Access Table

Posted on 2000-04-04
3
178 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Write data from SQL to CSV file - position 1 60
VBA color chart bars 12 85
using Access 8 68
RUNRMTCMD from AS/400 12 46
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 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