A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

save record



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2008, 07:21 PM posted to microsoft.public.access.forms
rml
external usenet poster
 
Posts: 172
Default 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  
Old April 14th, 2008, 11:01 PM posted to microsoft.public.access.forms
Steve Sanford
external usenet poster
 
Posts: 190
Default 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  
Old April 15th, 2008, 02:39 PM posted to microsoft.public.access.forms
rml
external usenet poster
 
Posts: 172
Default 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  
Old April 15th, 2008, 08:14 PM posted to microsoft.public.access.forms
Steve Sanford
external usenet poster
 
Posts: 190
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.