Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

save record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rml - 14 Apr 2008 19:21 GMT
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
Steve Sanford - 14 Apr 2008 23:01 GMT
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
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> 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
[quoted text clipped - 9 lines]
> 50 [Pos2] = "1000"
> 70 End Sub
rml - 15 Apr 2008 14:39 GMT
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.

> VBA doesn't use line numbers. I haven't see Basic with line numbers since
> programming my Apple II or the XT.
[quoted text clipped - 24 lines]
> > 50 [Pos2] = "1000"
> > 70 End Sub
Steve Sanford - 15 Apr 2008 20:14 GMT
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?

Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> 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,
[quoted text clipped - 34 lines]
> > > 50 [Pos2] = "1000"
> > > 70 End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.