D
Deleted member 8621
Guest
I am tyring to set a variable to a value produced in a field by a query. I can't get the reference correct.
My goal is to take the value of a field on a form and check it against the value in the query. The query value is the last record for a specific store. The sloppy code (I'm new at this) that I have so far is:
Private Sub Text5_GotFocus()
On Error GoTo modOpenfrmMeterData_Err
Dim crec As String
Dim lrec As String
Set newqry = New ADODB.Recordset
Set new = newqry.Open qryStoreLastRec
crec = [Serial Number]
lrec = Recordset.qryStoreLastRec![Serial Number]
MsgBox lrec
' If crec = lrec Then
' MsgBox "This is the last record for your store"
' End If
DoCmd.OpenForm "frmMeterData", acNormal, "", "", , acNormal
DoCmd.RepaintObject acForm, "frmMeterData"
modOpenfrmMeterData_Exit:
Exit Sub
modOpenfrmMeterData_Err:
MsgBox Error$
Resume modOpenfrmMeterData_Exit
End Sub
Thanks for your help in advance.
matthew
My goal is to take the value of a field on a form and check it against the value in the query. The query value is the last record for a specific store. The sloppy code (I'm new at this) that I have so far is:
Private Sub Text5_GotFocus()
On Error GoTo modOpenfrmMeterData_Err
Dim crec As String
Dim lrec As String
Set newqry = New ADODB.Recordset
Set new = newqry.Open qryStoreLastRec
crec = [Serial Number]
lrec = Recordset.qryStoreLastRec![Serial Number]
MsgBox lrec
' If crec = lrec Then
' MsgBox "This is the last record for your store"
' End If
DoCmd.OpenForm "frmMeterData", acNormal, "", "", , acNormal
DoCmd.RepaintObject acForm, "frmMeterData"
modOpenfrmMeterData_Exit:
Exit Sub
modOpenfrmMeterData_Err:
MsgBox Error$
Resume modOpenfrmMeterData_Exit
End Sub
Thanks for your help in advance.
matthew