record fields in table

F

Fred

hi... i wish this code record fields(nome,IPCMref and POTdec),only with is
not exist in the table...the problem is that code record filds when this
fields exist in table, other problem is the button cancel in the msgbox, i
want this button cancel return to the form without record..but this not
happening.
the code is:

nome.SetFocus
If nome.Text = "" Then
MsgBox "Necessita de preencher todos os campos.", vbInformation
Else
If IPCMref2.Value = "" Then
MsgBox "Necessita de preencher todos os campos.", vbInformation
Else
If POTdec2.Value = "" Then
MsgBox "Necessita de preencher todos os campos.", vbInformation
Else
If Me.[nome] = DLookup("[Nome do Parque]", "[Consulta_parque]") Then
MsgBox "O Parque já se encontra adicionado.", vbInformation
Else
If MsgBox("Deseja adicionar o Parque?", vbQuestion + vbOKCancel) = vbCancel
Then
Cancel = True
Else
If Me.Dirty Then Me.Dirty = False
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.Close
DoCmd.OpenForm "input"
DoCmd.Close
DoCmd.OpenForm "apresentacao", acNormal

thanks

Fred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top