PLease someone help me, editing fields in Access database using MS Visual Basic 5.0

PLease someone help me, editing fields in Access database using MS Visual Basic 5.0

Post by Robert Kruge » Sun, 04 Oct 1998 04:00:00



I am creating a Visual Basic app which will be used to test proficiency
levels for employees.  I am using MS Access as the database engine.  I have
two tables;

1.)    Employee Data: (Last Name),( First Name), (Employee Number), (Date),
(Test Score)

2.)    Proficiency Test: (Questions), (Correct Answer), (Your Answer)

How can I clear the records in the field (Your Answer) automataically when
the program is initiated?

I have been struggling with the program and I cannot seem to resolve the
problem.  data1.recordset.edit seems to be the appropriate tool, but I don't
understand how to use it.

Any help would be greatly appreciated.

 
 
 

PLease someone help me, editing fields in Access database using MS Visual Basic 5.0

Post by etta » Sun, 04 Oct 1998 04:00:00


Make a Table called "ANSWERS" and name the field "YourAnswers"
remove it form the second Table. Then create a sql statement in the
Form_Load to delete all the records in the ANSWERS Table, before
you load the rest of the database. This way the answers will all ways
be blank when the database is loaded. Also make sure that you have
Allow Zero Length in Access set to yes, that way if the answer is left
empty you will not get a error.

HTH,

etta


>I am creating a Visual Basic app which will be used to test proficiency
>levels for employees.  I am using MS Access as the database engine.  I have
>two tables;

>1.)    Employee Data: (Last Name),( First Name), (Employee Number), (Date),
>(Test Score)

>2.)    Proficiency Test: (Questions), (Correct Answer), (Your Answer)

>How can I clear the records in the field (Your Answer) automataically when
>the program is initiated?

>I have been struggling with the program and I cannot seem to resolve the
>problem.  data1.recordset.edit seems to be the appropriate tool, but I
don't
>understand how to use it.

>Any help would be greatly appreciated.


 
 
 

PLease someone help me, editing fields in Access database using MS Visual Basic 5.0

Post by Robert Kruge » Mon, 05 Oct 1998 04:00:00


I found a better way!!  this is what I did on the form initialize;
    Do While counter < records
        If Data2.Recordset.youranswer <> "" Then
            Data2.Recordset.Edit
            Data2.Recordset.youranswer = ""
            Data2.Recordset.Update
            Data2.Recordset.MoveNext
        Else
            Data2.Recordset.MoveNext
        End If
        counter = counter + 1
    Loop

It works just the way I wanted.  Whew!!

Thanks you for your suggestion though.


>Make a Table called "ANSWERS" and name the field "YourAnswers"
>remove it form the second Table. Then create a sql statement in the
>Form_Load to delete all the records in the ANSWERS Table, before
>you load the rest of the database. This way the answers will all ways
>be blank when the database is loaded. Also make sure that you have
>Allow Zero Length in Access set to yes, that way if the answer is left
>empty you will not get a error.

>HTH,

>etta


>>I am creating a Visual Basic app which will be used to test proficiency
>>levels for employees.  I am using MS Access as the database engine.  I
have
>>two tables;

>>1.)    Employee Data: (Last Name),( First Name), (Employee Number),
(Date),
>>(Test Score)

>>2.)    Proficiency Test: (Questions), (Correct Answer), (Your Answer)

>>How can I clear the records in the field (Your Answer) automataically when
>>the program is initiated?

>>I have been struggling with the program and I cannot seem to resolve the
>>problem.  data1.recordset.edit seems to be the appropriate tool, but I
>don't
>>understand how to use it.

>>Any help would be greatly appreciated.

 
 
 

PLease someone help me, editing fields in Access database using MS Visual Basic 5.0

Post by Speed » Thu, 08 Oct 1998 04:00:00


I have had problems with the spaces in my data fields.  Hope this helps.

    with data1.recordset
        .edit
        !Your Answer = " "
        .Update
    end with



>I am creating a Visual Basic app which will be used to test proficiency
>levels for employees.  I am using MS Access as the database engine.  I have
>two tables;

>1.)    Employee Data: (Last Name),( First Name), (Employee Number), (Date),
>(Test Score)

>2.)    Proficiency Test: (Questions), (Correct Answer), (Your Answer)

>How can I clear the records in the field (Your Answer) automataically when
>the program is initiated?

>I have been struggling with the program and I cannot seem to resolve the
>problem.  data1.recordset.edit seems to be the appropriate tool, but I
don't
>understand how to use it.

>Any help would be greatly appreciated.

 
 
 

1. Regarding Accessing External database using MS-Access and MS-Visual Basic

Hi from Srinivas
I have a problem when I have an attached a table from an external
Database(foxpro version 2.6 for Dos,*.dbf) to Access 2.0 database.I am
using Visual Basic on Windows-95.
I need to Delete or Update records in the external Database(Attached
Table) and want to reflect those changes in the attached table (i.e in
Access) using Visual Basic.
There are two ways of doing it.
1) Use a Tabledef object(Visual Basic) to create a attached table in
Access and then carry out necessary actions like Delete or Update on the
External table. But this Tabledef is Readonly and not letting me to
Delete or Update the attached External table.

This is the help in VB about deleting records for a Externally attached
Foxpro Database.
Deleted Records:
In most cases, if you Delete a record when working with External data,
the record is actually removed from the source table.  When working with
FoxPro tables, however, Deleted records aren't actually removed until
the table is packed using FoxPro commands or utilities.  The Jet
engine's CompactDatabase method of the DBEngine object works only on Jet
Databases; it has no effect on Microsoft FoxPro Databases.
You can tell the Jet database engine not to include deleted records by
setting the Deleted parameter of the initialization settings to True.
If you set the Deleted parameter to False, all records are included in
any Recordset objects you create, even deleted records.

I tried this by setting the Deleted Parameter = true in the
MsAccess20.ini(in windows directory)
I then opened the Access database and checked the external table. But
still I dont have the most recent or refreshed view of the external
database.
This didnt work.

2) Use the OpenDatabase directly on the external database using the
Connect string and then open a Recordset and then carry out necessary
actions like Delete or Update on the External Table.
But still I dont have the most recent or refreshed view of the external
database.
It works only when I open the Foxpro Database (version 2.6 for Dos) and
Pack and Reindex it.
Could someone suggest me is there any other way to get around this
problem.Should the external Database opened in Exclusive mode for action
related Queries(Delete or Update)
Which is the better method using Tabledef method or OpenDatabase method.


2. quering with nolock

3. NC-WILMINGTON-113234--Visual Basic-RDBMS-ORACLE-SYBASE-MS ACCESS-MS SQL Server-VISUAL BASIC/RDBMS

4. Automate setup of Merge Replication

5. GA-Atlanta-98153--Visual Basic-MS ACCESS-RDBMS-ORACLE-Programmer-Visual Basic and Access

6. load a file in sequence

7. About COPY

8. IL-Chicago-47740--Programming Skills-Visual Basic-ORACLE-DBMS-MS ACCESS-Programmer-Visual Basic + Oracle