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 / New Users / April 2004

Tip: Looking for answers? Try searching our database.

Insert Command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Sprinkel - 08 Apr 2004 19:28 GMT
I have been using the following code in a NotInList
procedure to insert a new record into a table, and then
open a data entry form by the linking criteria.  In this
case, JobNumber is the primary key.

strfql = "Insert Into tblProjects([JobNumber]) values ('"
& NewData & "')"
CurrentDb.Execute strsql, dbFailOnError
strLinkCriteria="[JobNumber]=&NewData & "' "
DoCmd.OpenForm strFrmName,,,strLinkCriteria
Response = acDataErrAdded

I would like some help adapting this general strategy to a
different situation.  This time, the primary key is an
AutoNumber field, and I would like to set the value of two
fields in the inserted record--one to the NewData that
wasn't in the list, and the value from another combo box
on the form.

In detail, the target table is:

SteelSizes
==========
SteelSizeID  AutoNumber
SteelType    Number, FK to SteelTypes
SteelSize    Text consisting of dimensions, e.g., 4x8x1/2
LBperLF      Number  (Pounds per lineal foot)
SFperLF      Number  (Square feet of surface area per LF)

and I would like NewData to go to [SteelSize] and the
value of cboSteelType to go to [SteelType] when the form
opens.

Thanks for all help.
Kevin Sprinkel
Kevin Sprinkel - 08 Apr 2004 20:27 GMT
>-----Original Message-----
>I have been using the following code in a NotInList
[quoted text clipped - 33 lines]
>Kevin Sprinkel
>.
 
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.