PDA

View Full Version : Need Help with access and VB


Alan
12-20-02, 16:59
I have an access database with two tables. Table A and Table B. My VB program connects to the database through ADO. I have 2 forms. Form A accesses table A and Form B accesses Table B. Form A has recordset A and form B has recordset B. The database itself has a child/parent relationship. Both of my forms are normal forms, not MDI. I can update access through the FormA, but when I try it through form B I get an error> It wont let me update the table because it has a field that is required in table A.

What am I doing wrong?

rnealejr
12-21-02, 21:09
What error are you receiving ? What is the sql statement that it is failing on ?

Loetchie
03-06-03, 12:27
Maybe you should just give some extra code that says that every time you update B that A als is being updated automatically

visualsander
04-09-03, 04:51
Originally posted by Alan
I have an access database with two tables. Table A and Table B. My VB program connects to the database through ADO. I have 2 forms. Form A accesses table A and Form B accesses Table B. Form A has recordset A and form B has recordset B. The database itself has a child/parent relationship. Both of my forms are normal forms, not MDI. I can update access through the FormA, but when I try it through form B I get an error> It wont let me update the table because it has a field that is required in table A.

What am I doing wrong?

Hi there,

as I understand it table A is the parent. That's why you can update this.
Table b is thus the child so it needs to have a relation ship to table a.
EG:
table A
IDA
nameA

Table B
IDA
IDB
NameB

[table A].IDA = [table B].IDA.

So in you're form you would need the fields:
IDA, IDB and NameB.

so you would get something like:
UPDATE TABLE B
SET Nameb = strNameB, IDB = i
WHERE tableB.IDA = tableA.IDA

HTH

VS