F
Fred
Hi.. I'm having a problem with my form.. It has 3 textboxs connected to a
table.. On the form options "data entry" = yes..
The problem i have it's that i made this form to add those 3 field to a
table and i only want to add them when the user clicks the "ADD" button.. but
what is happening is that automaticly when the user just clicks one of those
3 textboxs, not even needs to write something, if i close it on the X (its a
popup form) or if i click the "CANCEL" button when i check the table a new
registry was made.. I dont want that.. i only want the record to be made when
the user clicks the "ADD" button with this code:
Private Sub Command1_Click()
If IsNull(DLookup("Park", "Query_park")) = False Then
MsgBox "Park already created!"
Else
If IsNull(parkname) = True Or IsNull(area) = True Or IsNull(Panel) = True Then
MsgBox "ERROR:Fill every field"
Else
If Me.Dirty Then Me.Dirty = False
DoCmd.RunCommand acCmdRecordsGoToNew
MsgBox "Parque adicionado!"
DoCmd.Close
DoCmd.OpenForm "Form2"
End If
End If
End Sub
How can i solve this problem??
I cant have blank records or Wrong records on the table connected to this
form because on other form i have a combobox looking up for the "parkname"
column of the table..
Thanks
Nuno
table.. On the form options "data entry" = yes..
The problem i have it's that i made this form to add those 3 field to a
table and i only want to add them when the user clicks the "ADD" button.. but
what is happening is that automaticly when the user just clicks one of those
3 textboxs, not even needs to write something, if i close it on the X (its a
popup form) or if i click the "CANCEL" button when i check the table a new
registry was made.. I dont want that.. i only want the record to be made when
the user clicks the "ADD" button with this code:
Private Sub Command1_Click()
If IsNull(DLookup("Park", "Query_park")) = False Then
MsgBox "Park already created!"
Else
If IsNull(parkname) = True Or IsNull(area) = True Or IsNull(Panel) = True Then
MsgBox "ERROR:Fill every field"
Else
If Me.Dirty Then Me.Dirty = False
DoCmd.RunCommand acCmdRecordsGoToNew
MsgBox "Parque adicionado!"
DoCmd.Close
DoCmd.OpenForm "Form2"
End If
End If
End Sub
How can i solve this problem??
I cant have blank records or Wrong records on the table connected to this
form because on other form i have a combobox looking up for the "parkname"
column of the table..
Thanks
Nuno