I use the following code to generate a production number from values stored in a MySQL database. What I want to do is to use this generated number within an acces report. How can I get this arbitrary value into a report, short of server-side stuff, which is proving to be harder than I anticipated.
Code:
SQLout = "SELECT h.ht_id, h.softver, h.House_type"
SQLout = SQLout & " , b.ShortCode AS builder_ShortCode"
SQLout = SQLout & " , q.design_level"
SQLout = SQLout & " , h.Floor"
SQLout = SQLout & " , h.Revision"
SQLout = SQLout & " , d.ShortCode AS dist_ShortCode"
SQLout = SQLout & " FROM HouseType AS h"
SQLout = SQLout & " INNER JOIN quotations as q on q.quote_id = h.quote_id"
SQLout = SQLout & " INNER JOIN CompShort as b ON b.Comp_ID = q.build_id"
SQLout = SQLout & " INNER JOIN CompShort as d ON d.Comp_ID = q.dist_id"
SQLout = SQLout & " WHERE h.quote_id = " & Me.se
SQLout = SQLout & " and deleted = 0"
SQLout = SQLout & " ORDER BY House_Type"
Call connectDB
Call getData
If Not rst.EOF Then
rst.MoveFirst
Do
'loop through resultset
f(0) = rst.Fields(0)
f(1) = rst.Fields(1)
For I = rst.Fields.Count - 1 To 2 Step -1
If IsNull(rst.Fields(I)) Then
f(I) = ""
ElseIf rst.Fields(I) = "non" Then
f(I) = ""
ElseIf I = 6 Then [COLOR=green]'field where integer value of revision is kept[/color]
If rst.Fields(I) = 0 Then
f(I) = ""
Else
rev = rst.Fields(I)
f(I) = "=rev-" & Chr(96 + rev) [COLOR=green]'Converts integer revision into a letter[/color]
End If
Else
f(I) = "=" & rst.Fields(I)
End If
Next I
field0 = rst.Fields(2)
[COLOR=green]'field format is version=builder-region=level=housetype=floor=revision=distributor[/color]
field1 = f(1) & f(3) & f(4) & f(2) & f(5) & f(6) & f(7)
Me.ListPos.AddItem item:="" & f(0) & ";" & field1 & ""
rst.MoveNext
Loop Until rst.EOF
End If
cn.CLose