consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

A Coder's Notes

Email :
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull

Get connected and Online Tottington
remote management Makerfield code and design Aspull

MS Access Code to Place SQL Values Into Report - 26/10/2011

MS Access reports are quite useful and powerful, but there are times where you may wish to set a certain field (field 4 in this case) with the results of a database query (in this case field1 and field2).  This is mostly for my notes and my memory!

Dim dbs As Database, rst As Recordset, qwe As String

Set dbs = DBEngine.Workspaces(0).Databases(0)

qwe = "SELECT field1, field2 FROM mytable WHERE field3 = " & Me.field3.Text

Set rst = dbs.OpenRecordset(qwe)

If Len(rst("field1")) > 1 Then
 Me!field4 = rst("field1")
 Me!field4 = rst("field2")
End If


Post A Comment

Name Comment
programming services specialist
Valid XHTML 1.0 Transitional