Solved

VB and Access Table

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String manipulation in Visual Basic 7 82
Best way to parse out a json string in VB6? 10 281
Copy a row 12 69
Help me. 3 69
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

756 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