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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RST .add

Status
Not open for further replies.

RobJaxon

Technical User
Joined
Apr 8, 2023
Messages
2
Location
GB
Any help would be appreciated, and I thank you in advance

Trying to add a new record to Tbl_Inspections whilst in a Form code below. VB is not highlighting an debug issues but nothing appears in the table once the button has been clicked.

Private Sub ComInsp_Click()
Set rst = CurrentDb.OpenRecordset("Select * From Tbl_Inspections;")
With rst
.AddNew
!Tag_ID = Me.Tag_ID
!Concept = Me.Concept
!Insp_Type = Me.CBOType
rst.Close
Set rst = Nothing
End With
End Sub

!Tag_ID, !Concept and !Insp_Type are fields in Tbl_Inspections, Tag_ID in both tables are Long Integer, Concept and Insp_Type are Short Text 5 characters, CBOType is a combo box in the open form that the code is run from.

It's a long long time since I've done work in Access and now scratching my head.

Thanks
Rob
 
I don’t see any Dim of objects like

Dim rst As DAO.Recordset
Also you need to add

rst.Update
rst.close

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you Duane, worked a treat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top