VB6 Database mystery

VB6 Database mystery

Post by Arne Jonss » Wed, 10 Feb 1999 04:00:00

I have a query based on two related tabels in an Access database. I
have added commands in the dataenvironment for both the tables and the
query. I made the query as an SQL statement. The structure of the
database is like this:

Table Editor

Table Title
Format   '(Hardback or paperbback)
(and some other fields related to the title)

In the query I have both the EditorID (from tableTitle) and EditorName
(from table Editor) and both of them are on a form I will use for
searching records (by title) and also adding, editing and deleting
Now, if I  add a record and fill the editorname field and the editor
ID field, Ill have this errormessage:
"The field Editor.EditorID cant contain a Null value because the
required property for this field is set to True. Enter a value in this
Then if I dont fill the editorname field but only the editorID field
it works okey and the record is added.

How I want it to work is like this: I want to pick the editorname from
a combobox and have the editor ID filled in automatic (or not at all
if it is possible). There will be around 100 editors. The application
must function on a network. From learning reasons I would like to do
it without the datacontrol (and because everybody says its no good).
Someone who has some explanation to the "mystery" above and some hints
on how I make it the way I want it?


1. The mystery of DataGrid Refresh in VB6...

* This sub deletes the selected invoice in the data grid (works fine).    *
* datagrid2.refresh in the same sub didn't work, so I started playing ... *
* See below this sub ...                                                  *

Private Sub btnDeleteInvoice_Click()
    Dim rs As Recordset

    With adoControledByCode
        .CommandType = adCmdTable
        .RecordSource = "Invoices"
        Set rs = .Recordset
        With rs
            .Find ("Invoice_Id = " & DataGrid2.Columns(0))
        End With
    End With
End Sub

* The code in the SUB below is needed to refresh the datagrid after       *
* deleting an invoice.                                                    *
* Now for adding to the mistery of datagrid.refresh :                     *
* - the code below, as you can see is attached to a button click event.   *
*   This way the refresh of the datagrid is done correctly !              *  
* - as I tested the code and found it to be correct, I added it to the    *
*   above (the delete sub). Why ? Because I want the refresh to happen    *
*   automatically of course !                                             *
* AND WHAT HAPPENS ??? You could have guessed it of course : it doesn't   *
* work ! Even if I put the code in a sub and then call it, it doesn't do  *
* the refresh ! It only works when I use the button to refresh the grid ! *
Private Sub btnRefreshGrid_Click()
    With adoInvoiceList
        .CommandType = adCmdText
        .RecordSource = "SELECT blabla...blabla...correct SQL String...bla;"
    End With

    Set DataGrid2.DataSource = adoInvoiceList.Recordset
    With DataGrid2
    End With
End Sub

*  Help !?!?! *

2. Problem since new Ingres/Net installation

3. database diagram mystery continues

4. backup DTS to be able to restore

5. Open Database...mystery

6. backup failed ( I/O)error

7. Mystery: ADO connects to database but fields don't appear on some computers

8. Extended filtering

9. Database link. Select performance mystery

10. Mystery database space reclaimation!!

11. VB6 - Database Diagram for Access Database

12. VB6 / ISAM Databases w/mdb Databases

13. VB6 + SP4 error in vb6.dll