Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert statement

Status
Not open for further replies.

Sarah28

IS-IT--Management
Aug 6, 2000
16
0
0
US
Visit site
When I save my purchase order(based on purchase order table) I would like to add a new record to my shipping table. The following code gives me an "Invalid use of Null" error. The following is my code...Can anyone help me?

Dim db As Database
Dim qdf As QueryDef
Dim rst As Recordset
Dim str As String
Dim txtID As String

txtID = Me!txtID

Set db = CurrentDb

str = "INSERT INTO dbo_Shipping " _
& "(MachineID, Complete) " _
& "VALUES(" & Me.txtID & ",1)"

Set qdf = db.CreateQueryDef("", str)

qdf.Execute

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
 
Be sure the value in Me!txtID contains a value if the MachineID is a key to the shipping table, and/or especially if the MachineID has in the shipping table the property set to No for Allow Zero Length.

Hope this helps.

Scott.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top