Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the same adodc connection for two separate forms
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00614693
Message ID:
00615837
Views:
16
>Hi Eric,
>The LockType is set to adLock Optimistic. It was defaulted at that so what should I change it to?
>The Addnew works on the first form for the first table but doesn't give a blank record for the second table. The fields are blank but when I try to save the information in the text boxes it desn't save.
>
>Thanks again!
>Max
>>Are you able to use AddNew on your first form? Have you changed the LockType to something else then ReadOnly? Try the AddNew without the JOIN (only on 1 table).

I have build a very thin sample:
-2 forms
-each form has 2 textboxes and 1 adodc
-the first form has a command button
-all textboxes are bound to the according adodc and the datafields are set to LastName & FirstName.
-On the first form, I made a connectionstring to the NWind Access database. I have set the RecordSource to "Select * from Employees".

The code for Form1 is:
Option Explicit

Private Sub Command1_Click()
    Form2.Show
End Sub
The code for Form2 is:
Option Explicit

Private Sub Form_Load()
    Set Form2.Adodc1.Recordset = Form1.Adodc1.Recordset
End Sub
With only this I can update anything from form1 or 2 without any problems.

To be able to update, I need to set the EOFAction to 2 (adDoAddNew) on Form2 and it is still working.

So it seems that the problem is not the recordset but the way you try to save your data. Is your form2 DataBound?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform