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 |
#1
|
|||
|
|||
save record
Can anyone tell me what might be going on with this simple code. I have this
code on a command button, it does what I want it to do. When I close the form, it say it can't save this record. I close the form and the record is in the table. I'm sure there is a better way to do this. Thanks. Private Sub Form_AfterUpdate() If Not IsNumeric([Pos]) Then GoTo 50 [Pos2] = [Pos] GoTo 70 50 [Pos2] = "1000" 70 End Sub |
#2
|
|||
|
|||
save record
VBA doesn't use line numbers. I haven't see Basic with line numbers since
programming my Apple II or the XT. Try this: Private Sub Form_AfterUpdate() If Not IsNumeric([pos]) Then [Pos2] = "1000" Else [Pos2] = [pos] End If End Sub HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "rml" wrote: Can anyone tell me what might be going on with this simple code. I have this code on a command button, it does what I want it to do. When I close the form, it say it can't save this record. I close the form and the record is in the table. I'm sure there is a better way to do this. Thanks. Private Sub Form_AfterUpdate() If Not IsNumeric([Pos]) Then GoTo 50 [Pos2] = [Pos] GoTo 70 50 [Pos2] = "1000" 70 End Sub |
#3
|
|||
|
|||
save record
Thanks, that works the same. My problem is still the same. When I close the
form, it tells me that it can't same the record at this time. If I say ok, the form close and the records is saved in the table. I think it is a timing issue. When I remove [Pos2] = [pos] from the code the records saves without being prompted. Any ideas what might be happening here? Thanks. "Steve Sanford" wrote: VBA doesn't use line numbers. I haven't see Basic with line numbers since programming my Apple II or the XT. Try this: Private Sub Form_AfterUpdate() If Not IsNumeric([pos]) Then [Pos2] = "1000" Else [Pos2] = [pos] End If End Sub HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "rml" wrote: Can anyone tell me what might be going on with this simple code. I have this code on a command button, it does what I want it to do. When I close the form, it say it can't save this record. I close the form and the record is in the table. I'm sure there is a better way to do this. Thanks. Private Sub Form_AfterUpdate() If Not IsNumeric([Pos]) Then GoTo 50 [Pos2] = [Pos] GoTo 70 50 [Pos2] = "1000" 70 End Sub |
#4
|
|||
|
|||
save record
all I did was edit the code you provided. Not being able to see your MDB, I
have no idea if it is a timing issue. I know nothing about your form, controls or tables. Basically, your code says "If the value in is not a number put the text "1000" in [Pos2] Else put [pos] in [Pos2]. Is the data type of [Pos2] String or Number? -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "rml" wrote: Thanks, that works the same. My problem is still the same. When I close the form, it tells me that it can't same the record at this time. If I say ok, the form close and the records is saved in the table. I think it is a timing issue. When I remove [Pos2] = [pos] from the code the records saves without being prompted. Any ideas what might be happening here? Thanks. "Steve Sanford" wrote: VBA doesn't use line numbers. I haven't see Basic with line numbers since programming my Apple II or the XT. Try this: Private Sub Form_AfterUpdate() If Not IsNumeric([pos]) Then [Pos2] = "1000" Else [Pos2] = [pos] End If End Sub HTH -- Steve S -------------------------------- "Veni, Vidi, Velcro" (I came; I saw; I stuck around.) "rml" wrote: Can anyone tell me what might be going on with this simple code. I have this code on a command button, it does what I want it to do. When I close the form, it say it can't save this record. I close the form and the record is in the table. I'm sure there is a better way to do this. Thanks. Private Sub Form_AfterUpdate() If Not IsNumeric([Pos]) Then GoTo 50 [Pos2] = [Pos] GoTo 70 50 [Pos2] = "1000" 70 End Sub |
Thread Tools | |
Display Modes | |
|
|