Hi Gang - got an issue here and I think I'm having problems seeing the forest through the trees so I hope one of you good people can help me out!
I have created an ADO recordset that returns 1 record. I want to grab that value and add it to a variable but I can't seem to remember how to reference the field in VBA (been working with VBScript for a while and it's messing me up!)
I tried to use rst.Fields(FIELDNAME).Value but this didn't work... Can someone tell me how to get the results from a recordset?
Here is the code I'm working with if it helps:
Thanks in Advance!
Kev
I have created an ADO recordset that returns 1 record. I want to grab that value and add it to a variable but I can't seem to remember how to reference the field in VBA (been working with VBScript for a while and it's messing me up!)
I tried to use rst.Fields(FIELDNAME).Value but this didn't work... Can someone tell me how to get the results from a recordset?
Here is the code I'm working with if it helps:
Dim rst As Recordset
Dim strSQL As String
Dim Numrec As String
Set rst = New ADODB.Recordset
strSQL = "SELECT Max(dbo_PARKINVT_INVENTORY.GPSSURVEY_ID) AS MaxOfGPSSURVEY_ID FROM dbo_PARKINVT_INVENTORY GROUP BY dbo_PARKINVT_INVENTORY.UNITID, Left([GPSSURVEY_ID],1) HAVING (((dbo_PARKINVT_INVENTORY.UNITID)=" & Me.Combo6 & " And ((Left([GPSSURVEY_ID],1))='" & Me.cboGPSF & "')));"
rst.Open strSQL, CurrentProject.Connection, adOpenStatic, adLockOptimistic
If rst.RecordCount = 1 Then
Numrec = THIS IS WHERE I NEED TO REFERENCE THE RETURNED DATA
Thanks in Advance!
Kev