If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
don't save empty row in table
As I told you, all my fields are bound fields and I have code in form
properties: OnOpen [Event Procedure]: Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub Solution with Esc is ok for me, but this form will use and other people, and I can't tell them to do Esc, if they don't want to save that record. I wrote some code by macro with IsNull option, something like: if all fields are empty, don't save that record. But, it wasn't work. That 's it. And thanks anyway. Smoki "BruceM" wrote: My SomeField is the same idea, I think, as AVeryKeyField in the other part of this thread. Test the value of a field that must be filled in. If it is blank, don't save the record (or at least give the user the option, as I suggested). Regarding bound fields, the information entered into them is saved as soon as the record is updated. The record is updated when you move to another record, close the form, close the database, or explicitly save the record (there are a few other ways this can happen, I think). Until the record is saved, pressing Esc twice will undo the record, or you can use the Undo code. You say you tried "something" with Undo, but what exactly is that? Assume when somebody is trying to help that there is a reason for questions they ask. If you need further help, please respond to the questions I asked in the previous posting. "Smoki" wrote in message ... All my fields are bound fields, so every data which I enter in this fields have been saved in my table. But, if I enter something in my form, and then decide not to save this data, I manually delete data from fields, and when I close my form, and check the table I see that I have 1 empty row in my table. I tried somthing with this IsNull function, but my form doesn't work than, maybe it is because my fields are bound? "BruceM" wrote: Do you have code that saves the record as soon as it is created, or anything like that? You say you "delete everything from fields in the form". How did the data get into those fields so that it was necessary to delete it? Does pressing Esc twice eliminate the problem? If so, Undo can be placed into the code somewhere. For instance, in the form's Before Update event you could have something like: If IsNull(Me.SomeField) Then If MsgBox ("Cancel the record?",vbYesNo) = vbYes Then Me.Undo End If End If "Smoki" wrote in message ... I know that empty row with asterisk represents new record. But my empty row is not with asterisk, the only field in this row which is not empty is ID field (AutoNumber), but other columns (which are connected with fields on my form) are empty. So, I have that empty row, and my next row has asterisk (this row is for new record). Than I have manually to delete this row from my table, and ID already take next value. "BruceM" wrote: As I understand it, pressing Esc once will clear the current control; pressing Esc twice is the same as Undo in VBA -- it clears all fields in the unsaved record). A command button with Me.Undo as its click event is another way to clear the current record. However, it is not clear whether you have entered any data before you decide not to create a record. Does the empty row have an asterisk at the left side? If so, that row represents the new record, and will be there when you open the table in datasheet view. However, if there is a blank row other than that one you are saving the record. "Smoki" wrote in message ... Hy, I have a question. When I open my form, but I decide not to save that record, I delete everything from fields in form, but when I close my form, and open the table, I see that I have 1 empty row in my table. Does anyone have idea how to aviod this empty row? |
#12
|
|||
|
|||
don't save empty row in table
Since you aren't willing to try my Undo suggestion there is nothing more I
could have done anyhow. Good luck. "Smoki" wrote in message news As I told you, all my fields are bound fields and I have code in form properties: OnOpen [Event Procedure]: Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub Solution with Esc is ok for me, but this form will use and other people, and I can't tell them to do Esc, if they don't want to save that record. I wrote some code by macro with IsNull option, something like: if all fields are empty, don't save that record. But, it wasn't work. That 's it. And thanks anyway. Smoki "BruceM" wrote: My SomeField is the same idea, I think, as AVeryKeyField in the other part of this thread. Test the value of a field that must be filled in. If it is blank, don't save the record (or at least give the user the option, as I suggested). Regarding bound fields, the information entered into them is saved as soon as the record is updated. The record is updated when you move to another record, close the form, close the database, or explicitly save the record (there are a few other ways this can happen, I think). Until the record is saved, pressing Esc twice will undo the record, or you can use the Undo code. You say you tried "something" with Undo, but what exactly is that? Assume when somebody is trying to help that there is a reason for questions they ask. If you need further help, please respond to the questions I asked in the previous posting. "Smoki" wrote in message ... All my fields are bound fields, so every data which I enter in this fields have been saved in my table. But, if I enter something in my form, and then decide not to save this data, I manually delete data from fields, and when I close my form, and check the table I see that I have 1 empty row in my table. I tried somthing with this IsNull function, but my form doesn't work than, maybe it is because my fields are bound? "BruceM" wrote: Do you have code that saves the record as soon as it is created, or anything like that? You say you "delete everything from fields in the form". How did the data get into those fields so that it was necessary to delete it? Does pressing Esc twice eliminate the problem? If so, Undo can be placed into the code somewhere. For instance, in the form's Before Update event you could have something like: If IsNull(Me.SomeField) Then If MsgBox ("Cancel the record?",vbYesNo) = vbYes Then Me.Undo End If End If "Smoki" wrote in message ... I know that empty row with asterisk represents new record. But my empty row is not with asterisk, the only field in this row which is not empty is ID field (AutoNumber), but other columns (which are connected with fields on my form) are empty. So, I have that empty row, and my next row has asterisk (this row is for new record). Than I have manually to delete this row from my table, and ID already take next value. "BruceM" wrote: As I understand it, pressing Esc once will clear the current control; pressing Esc twice is the same as Undo in VBA -- it clears all fields in the unsaved record). A command button with Me.Undo as its click event is another way to clear the current record. However, it is not clear whether you have entered any data before you decide not to create a record. Does the empty row have an asterisk at the left side? If so, that row represents the new record, and will be there when you open the table in datasheet view. However, if there is a blank row other than that one you are saving the record. "Smoki" wrote in message ... Hy, I have a question. When I open my form, but I decide not to save that record, I delete everything from fields in form, but when I close my form, and open the table, I see that I have 1 empty row in my table. Does anyone have idea how to aviod this empty row? |
#13
|
|||
|
|||
don't save empty row in table
I tried it, but it said Compile error in this row:
(Me.SomeField) I have some problems with this. Do I have instead of SomeField to put the name of my field, for example (Me.Location). I suppose this is the stupide question, but I don't know what to do! "BruceM" wrote: Since you aren't willing to try my Undo suggestion there is nothing more I could have done anyhow. Good luck. "Smoki" wrote in message news As I told you, all my fields are bound fields and I have code in form properties: OnOpen [Event Procedure]: Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub Solution with Esc is ok for me, but this form will use and other people, and I can't tell them to do Esc, if they don't want to save that record. I wrote some code by macro with IsNull option, something like: if all fields are empty, don't save that record. But, it wasn't work. That 's it. And thanks anyway. Smoki "BruceM" wrote: My SomeField is the same idea, I think, as AVeryKeyField in the other part of this thread. Test the value of a field that must be filled in. If it is blank, don't save the record (or at least give the user the option, as I suggested). Regarding bound fields, the information entered into them is saved as soon as the record is updated. The record is updated when you move to another record, close the form, close the database, or explicitly save the record (there are a few other ways this can happen, I think). Until the record is saved, pressing Esc twice will undo the record, or you can use the Undo code. You say you tried "something" with Undo, but what exactly is that? Assume when somebody is trying to help that there is a reason for questions they ask. If you need further help, please respond to the questions I asked in the previous posting. "Smoki" wrote in message ... All my fields are bound fields, so every data which I enter in this fields have been saved in my table. But, if I enter something in my form, and then decide not to save this data, I manually delete data from fields, and when I close my form, and check the table I see that I have 1 empty row in my table. I tried somthing with this IsNull function, but my form doesn't work than, maybe it is because my fields are bound? "BruceM" wrote: Do you have code that saves the record as soon as it is created, or anything like that? You say you "delete everything from fields in the form". How did the data get into those fields so that it was necessary to delete it? Does pressing Esc twice eliminate the problem? If so, Undo can be placed into the code somewhere. For instance, in the form's Before Update event you could have something like: If IsNull(Me.SomeField) Then If MsgBox ("Cancel the record?",vbYesNo) = vbYes Then Me.Undo End If End If "Smoki" wrote in message ... I know that empty row with asterisk represents new record. But my empty row is not with asterisk, the only field in this row which is not empty is ID field (AutoNumber), but other columns (which are connected with fields on my form) are empty. So, I have that empty row, and my next row has asterisk (this row is for new record). Than I have manually to delete this row from my table, and ID already take next value. "BruceM" wrote: As I understand it, pressing Esc once will clear the current control; pressing Esc twice is the same as Undo in VBA -- it clears all fields in the unsaved record). A command button with Me.Undo as its click event is another way to clear the current record. However, it is not clear whether you have entered any data before you decide not to create a record. Does the empty row have an asterisk at the left side? If so, that row represents the new record, and will be there when you open the table in datasheet view. However, if there is a blank row other than that one you are saving the record. "Smoki" wrote in message ... Hy, I have a question. When I open my form, but I decide not to save that record, I delete everything from fields in form, but when I close my form, and open the table, I see that I have 1 empty row in my table. Does anyone have idea how to aviod this empty row? |
#14
|
|||
|
|||
don't save empty row in table
There are some conventions in common use in these groups, such as referring
to something such as SomeField and expecting people to know they should substitute an actual field name, but it is easy to forget that some of this stuff is by no means intuitive. Yes, you need the name of an actual field from the form's record source. The idea is that it is a field that *must* be filled in. For instance, in a Contacts table the LastName field would be required. Without it there probably isn't much point to creating a record, so that is a field you could check. The code would go into the form's Before Update event. Let me know if you need guidance to put it in place. "Smoki" wrote in message ... I tried it, but it said Compile error in this row: (Me.SomeField) I have some problems with this. Do I have instead of SomeField to put the name of my field, for example (Me.Location). I suppose this is the stupide question, but I don't know what to do! "BruceM" wrote: Since you aren't willing to try my Undo suggestion there is nothing more I could have done anyhow. Good luck. "Smoki" wrote in message news As I told you, all my fields are bound fields and I have code in form properties: OnOpen [Event Procedure]: Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub Solution with Esc is ok for me, but this form will use and other people, and I can't tell them to do Esc, if they don't want to save that record. I wrote some code by macro with IsNull option, something like: if all fields are empty, don't save that record. But, it wasn't work. That 's it. And thanks anyway. Smoki "BruceM" wrote: My SomeField is the same idea, I think, as AVeryKeyField in the other part of this thread. Test the value of a field that must be filled in. If it is blank, don't save the record (or at least give the user the option, as I suggested). Regarding bound fields, the information entered into them is saved as soon as the record is updated. The record is updated when you move to another record, close the form, close the database, or explicitly save the record (there are a few other ways this can happen, I think). Until the record is saved, pressing Esc twice will undo the record, or you can use the Undo code. You say you tried "something" with Undo, but what exactly is that? Assume when somebody is trying to help that there is a reason for questions they ask. If you need further help, please respond to the questions I asked in the previous posting. "Smoki" wrote in message ... All my fields are bound fields, so every data which I enter in this fields have been saved in my table. But, if I enter something in my form, and then decide not to save this data, I manually delete data from fields, and when I close my form, and check the table I see that I have 1 empty row in my table. I tried somthing with this IsNull function, but my form doesn't work than, maybe it is because my fields are bound? "BruceM" wrote: Do you have code that saves the record as soon as it is created, or anything like that? You say you "delete everything from fields in the form". How did the data get into those fields so that it was necessary to delete it? Does pressing Esc twice eliminate the problem? If so, Undo can be placed into the code somewhere. For instance, in the form's Before Update event you could have something like: If IsNull(Me.SomeField) Then If MsgBox ("Cancel the record?",vbYesNo) = vbYes Then Me.Undo End If End If "Smoki" wrote in message ... I know that empty row with asterisk represents new record. But my empty row is not with asterisk, the only field in this row which is not empty is ID field (AutoNumber), but other columns (which are connected with fields on my form) are empty. So, I have that empty row, and my next row has asterisk (this row is for new record). Than I have manually to delete this row from my table, and ID already take next value. "BruceM" wrote: As I understand it, pressing Esc once will clear the current control; pressing Esc twice is the same as Undo in VBA -- it clears all fields in the unsaved record). A command button with Me.Undo as its click event is another way to clear the current record. However, it is not clear whether you have entered any data before you decide not to create a record. Does the empty row have an asterisk at the left side? If so, that row represents the new record, and will be there when you open the table in datasheet view. However, if there is a blank row other than that one you are saving the record. "Smoki" wrote in message ... Hy, I have a question. When I open my form, but I decide not to save that record, I delete everything from fields in form, but when I close my form, and open the table, I see that I have 1 empty row in my table. Does anyone have idea how to aviod this empty row? |
#15
|
|||
|
|||
don't save empty row in table
You 're right!!!
Thank you so much, it 's finnaly works! "BruceM" wrote: There are some conventions in common use in these groups, such as referring to something such as SomeField and expecting people to know they should substitute an actual field name, but it is easy to forget that some of this stuff is by no means intuitive. Yes, you need the name of an actual field from the form's record source. The idea is that it is a field that *must* be filled in. For instance, in a Contacts table the LastName field would be required. Without it there probably isn't much point to creating a record, so that is a field you could check. The code would go into the form's Before Update event. Let me know if you need guidance to put it in place. "Smoki" wrote in message ... I tried it, but it said Compile error in this row: (Me.SomeField) I have some problems with this. Do I have instead of SomeField to put the name of my field, for example (Me.Location). I suppose this is the stupide question, but I don't know what to do! "BruceM" wrote: Since you aren't willing to try my Undo suggestion there is nothing more I could have done anyhow. Good luck. "Smoki" wrote in message news As I told you, all my fields are bound fields and I have code in form properties: OnOpen [Event Procedure]: Private Sub Form_Open(Cancel As Integer) DoCmd.GoToRecord , , acNewRec End Sub Solution with Esc is ok for me, but this form will use and other people, and I can't tell them to do Esc, if they don't want to save that record. I wrote some code by macro with IsNull option, something like: if all fields are empty, don't save that record. But, it wasn't work. That 's it. And thanks anyway. Smoki "BruceM" wrote: My SomeField is the same idea, I think, as AVeryKeyField in the other part of this thread. Test the value of a field that must be filled in. If it is blank, don't save the record (or at least give the user the option, as I suggested). Regarding bound fields, the information entered into them is saved as soon as the record is updated. The record is updated when you move to another record, close the form, close the database, or explicitly save the record (there are a few other ways this can happen, I think). Until the record is saved, pressing Esc twice will undo the record, or you can use the Undo code. You say you tried "something" with Undo, but what exactly is that? Assume when somebody is trying to help that there is a reason for questions they ask. If you need further help, please respond to the questions I asked in the previous posting. "Smoki" wrote in message ... All my fields are bound fields, so every data which I enter in this fields have been saved in my table. But, if I enter something in my form, and then decide not to save this data, I manually delete data from fields, and when I close my form, and check the table I see that I have 1 empty row in my table. I tried somthing with this IsNull function, but my form doesn't work than, maybe it is because my fields are bound? "BruceM" wrote: Do you have code that saves the record as soon as it is created, or anything like that? You say you "delete everything from fields in the form". How did the data get into those fields so that it was necessary to delete it? Does pressing Esc twice eliminate the problem? If so, Undo can be placed into the code somewhere. For instance, in the form's Before Update event you could have something like: If IsNull(Me.SomeField) Then If MsgBox ("Cancel the record?",vbYesNo) = vbYes Then Me.Undo End If End If "Smoki" wrote in message ... I know that empty row with asterisk represents new record. But my empty row is not with asterisk, the only field in this row which is not empty is ID field (AutoNumber), but other columns (which are connected with fields on my form) are empty. So, I have that empty row, and my next row has asterisk (this row is for new record). Than I have manually to delete this row from my table, and ID already take next value. "BruceM" wrote: As I understand it, pressing Esc once will clear the current control; pressing Esc twice is the same as Undo in VBA -- it clears all fields in the unsaved record). A command button with Me.Undo as its click event is another way to clear the current record. However, it is not clear whether you have entered any data before you decide not to create a record. Does the empty row have an asterisk at the left side? If so, that row represents the new record, and will be there when you open the table in datasheet view. However, if there is a blank row other than that one you are saving the record. "Smoki" wrote in message ... Hy, I have a question. When I open my form, but I decide not to save that record, I delete everything from fields in form, but when I close my form, and open the table, I see that I have 1 empty row in my table. Does anyone have idea how to aviod this empty row? |
|
Thread Tools | |
Display Modes | |
|
|