**This is a continuation of a previous thread. To see the original posts, click on the "Full code is here" link below - Rory 14/09/2001**
Good eyes, ironically, in the code I used as a basis for this one, I had it as vbOK.
However, it didn't do what was expected -- it did give me back the ability to do breakpoints, and in doing so, I noticed something interesting when checking to see what variables were stored. It is only the first record of what appears to be the main table (rsMain). I even manually moved the records on the forms to other records, then ran the button -- it gave me the confirm message and then the forms shot back to the first record on the mainform and its related records! I ran it with breakpoints and saw that it is assigning variables to the first record values only (which would also be the same values in the rsTin recordset; yet, the Run number it assigned, was the one I input -- which had different 3 part common ID!
I also got back the <With block..object variable not defined> message I had the other day, when hovering over the .NoMatch, and field names (!*) assigned to the bill-half-Pc variables and to anything that should be associated to "With rsTin" block. It is as if it cannot see it -- what would cause that? The table it is based on is in the same database, and it looks as if I declared it properly. <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=acc&Number=74306&page=& view=&sb=&o=&vc=1>Full code is here</A>, and the snippet, with comments in <font color=red>RED</font color=red> I refer to is:
'Populate recordset, store low/high run numbers
lngLast = !Run <font color=red>lngLast shows the right value from rsTin, as does lngFirst, but !Run gives the With block missing error.</font color=red>
lngFirst = !Run
'Display high and low run numbers,
'ask operator for desired run number
strGuide = "Please enter a valid RUN number" & vbCrLf _
& "Between " & lngFirst & " and " & lngLast & "."
strInput = Trim(InputBox(strGuide))
If strInput = "" Then GoTo Exit_cmdFindRun_Click
strCriteria = "[Run] = " & CLng(strInput)
'Confirm entry with operator
strConfirm = "You Entered RUN NUMBER " & strInput & "." & vbCrLf & vbCrLf _
& "Check your paperwork." & vbCrLf _
& "If Incorrect, Cancel and Correct."
'find the record matching the input
If MsgBox(strConfirm, 289, "CONFIRM REQUEST") = vbOK Then
.FindFirst strCriteria<font color=red> 'strCriteria shows accurately, .FindFirst shows nothing</font color=red>
End If 'confirm msg box?
<font color=red>the variable below shows the value of the 1st record only, no matter what record it is on when called, or what run number is input. .NoMatch is giving the "with block missing" error message</font color=red>
If Not .NoMatch Then
strBill = !Bill_Num
strHalf = !Bill_Half
strPc = !PcNum
Any idea why this may be happening? Also, is it normal for the Dim statements to show values for the variables declared, when code is stopped like this? They are also showing the same values as the ones I mention -- first value of the main table, which brings up its related records!
Any ideas what might be causing this unusual behavior. The master/child links are fairly straightforward, and I don't see any other code that may be conflicting. All the other controls seem to working as designed. I even enabled the control showing the "Run" and did a find, and it will work as long as the run I am searching for is part of the mainform record displayed. (<font color=red>Run is automatically incremented on a new record, so it is disabled and locked -- could this have anything to do with it?</font color=red>)
Again, thank you for helping,