Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:48:47+00:00 2026-06-02T22:48:47+00:00

I have this code that should update my access database, but I keep getting

  • 0

I have this code that should update my access database, but I keep getting an error saying:

It is not possible so change or delete the regists because the table
‘MembrosCompasso’ has relating records.

This is my code:

Dim query1 As String = "UPDATE MembrosCompasso SET MembrosCompasso.BI=@compass_bi WHERE MembrosCompasso.BI=Membros.BI" ' Membros.Pai=@pai, Membros.Mae=mae WHERE BI=@BI"
Dim query As String = "UPDATE Membros  SET Membros.BI=@num_bi, Membros.Nome=@nome, Membros.Hablitacoes=@hablitacoes, Membros.Contribuinte=@contribuinte, Membros.Telemov=@telemov, Membros.DataNasc=@natnasc, Membros.LocalNasc=@localnasc, Membros.DataBaptismo=@databapt, Membros.LocalBapt=@localbapt, Membros.Sexo=@sexo, Membros.Naturalidade=@natu, Membros.Profissao=@prof, Membros.Estadocivil=@estadciv, Membros.DataCasamento=@datacas, Membros.LocalCasamento=@localcas, Membros.Notas=@notas, Membros.Email=@email WHERE Membros.BI=@BI" 

con.Close()
con.Open()
Dim command As New OleDbCommand(query, con)
Dim command1 As New OleDbCommand(query1, con)
' Indicação dos parâmetros que serão actualizados

command1.Parameters.Add("@compass_bi", OleDbType.VarChar).Value = BI.Text
command.Parameters.Add("@num_bi", OleDbType.VarChar).Value = BI.Text
command.Parameters.Add("@nome", OleDbType.VarChar).Value = Nome.Text
command.Parameters.Add("@hablitacoes", OleDbType.VarChar).Value = hablitacoes.Text
command.Parameters.Add("@contribuinte", OleDbType.VarChar).Value = ncront.Text
command.Parameters.Add("@telemov", OleDbType.VarChar).Value = telmov.Text
command.Parameters.Add("@natnasc", OleDbType.VarChar).Value = datnasc.Text
command.Parameters.Add("@localnasc", OleDbType.VarChar).Value = NascLocal.Text
command.Parameters.Add("@databapt", OleDbType.VarChar).Value = DataBapt.Text
command.Parameters.Add("@localbapt", OleDbType.VarChar).Value = LocalBapt.Text
command.Parameters.Add("@sexo", OleDbType.VarChar).Value = sexo.Text
command.Parameters.Add("@natu", OleDbType.VarChar).Value = natu.Text
command.Parameters.Add("@prof", OleDbType.VarChar).Value = profi.Text
command.Parameters.Add("@estadciv", OleDbType.VarChar).Value = estciv.Text
command.Parameters.Add("@datacas", OleDbType.VarChar).Value = datcas.Text
command.Parameters.Add("@localcas", OleDbType.VarChar).Value = localcas.Text
command.Parameters.Add("@notas", OleDbType.VarChar).Value = notas.Text
command.Parameters.Add("@email", OleDbType.VarChar).Value = email.Text
command.Parameters.Add("@BI", OleDbType.VarChar).Value = numero_BI

There is a screenshot of my access db schema here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:48:48+00:00Added an answer on June 2, 2026 at 10:48 pm

    It looks like you are trying to update the table MembrosCompasso before you make the change in table Membros.
    Because you set MembrosCompasso.BI to be related to Membros.BI, it must exists in that table first.

    If you set your relationship in Access to be automatically updated, you will not have to perform any manual update to MembrosCompasso, they will be updated automatically when you update the source field.

    For instance, say I have a PO table that has many POItem.
    I could set the one-to-many relationship between them as below:

    enter image description here

    In that case, if I update PO.ID, all POItem.POID fields will be updated.
    Same if I delete a given PO record, all related POItem records will also be deleted.

    Have a look at the MS Access documentation about table relationships.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this program that should execute a piece of code base on the
I have got a piece of code, that should countdown some number (in this
I have this code that works in a unit test but doesn't work when
I have this code that I want to make point-free; (\k t -> chr
I have this code that fetches some text from a page using BeautifulSoup soup=
I have this code that changes the opacity of the div on hover. $(#navigationcontainer).fadeTo(slow,0.6);
I have this code that has one button that let's me choose an entry
I have this code that saves a pdf file. FileStream fs = new FileStream(SaveLocation,
i have this code that will check the array contains the specific string and
I have this code that asks for a username and password. Just a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.