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

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
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")
Else
 Me!field4 = rst("field2")
End If

dbs.Close 

Post A Comment

Name Comment
programming services asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD