Step through code?

G

Guest

In VFP I could include the line..

SET STEP ON

...in my code, and when it fired, the execution of teh code would transfer to
a window where I could step through the code a line at a time OR evaluate the
values of any variables that might be referenced there.

I have this code in the AfterUpdate of a ComboBox:

Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I understand what the code is saying just fine, but it is blowing up on the
line that begins "rs.FindFirst". I need to find out what value it is reading
in cboProductFamily so that I can decide what to do about it.

So the question is "What is the moral equivalent, in Access, of SET STEP ON,
and how would I use it?"
 
M

MikeB

Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
STOP ' This works for me - Caps not reqd
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


Mike Byerley
 
G

Guest

<Chuckle> Your surname is spelled like my surname is frequently
mispronounced: Birley!

That was a great start for me. STOP worked like a charm. Now all I need to
do is decode the problem. I tweaked the diagnostic line, having determined
that the value of the Combobox (as I suspected) was a string value which wold
match a specific field in the controlling table (or query in this case).
Here's the tweak:

rs.FindFirst "[Product_Family] = " & Me![cboProductFamily]

...and when I try to run it I get Rin-time error '3077': Syntax error
(missing operator) in expression.

Easy for you, difficult for me <g>!
--
Dave
Temping with Staffmark
in Rock Hill, SC


MikeB said:
Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
STOP ' This works for me - Caps not reqd
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


Mike Byerley


Dave Birley said:
In VFP I could include the line..

SET STEP ON

..in my code, and when it fired, the execution of teh code would transfer to
a window where I could step through the code a line at a time OR evaluate the
values of any variables that might be referenced there.

I have this code in the AfterUpdate of a ComboBox:

Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I understand what the code is saying just fine, but it is blowing up on the
line that begins "rs.FindFirst". I need to find out what value it is reading
in cboProductFamily so that I can decide what to do about it.

So the question is "What is the moral equivalent, in Access, of SET STEP ON,
and how would I use it?"
 
D

Douglas J. Steele

What's the data type of Product_Family? If it's text, you need quotes around
the value:

rs.FindFirst "[Product_Family] = " & Chr$(34) & Me![cboProductFamily] &
Chr$(34)

(Chr$(34) is ")

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dave Birley said:
<Chuckle> Your surname is spelled like my surname is frequently
mispronounced: Birley!

That was a great start for me. STOP worked like a charm. Now all I need to
do is decode the problem. I tweaked the diagnostic line, having determined
that the value of the Combobox (as I suspected) was a string value which
wold
match a specific field in the controlling table (or query in this case).
Here's the tweak:

rs.FindFirst "[Product_Family] = " & Me![cboProductFamily]

..and when I try to run it I get Rin-time error '3077': Syntax error
(missing operator) in expression.

Easy for you, difficult for me <g>!
--
Dave
Temping with Staffmark
in Rock Hill, SC


MikeB said:
Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
STOP ' This works for me - Caps not reqd
Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


Mike Byerley


Dave Birley said:
In VFP I could include the line..

SET STEP ON

..in my code, and when it fired, the execution of teh code would
transfer to
a window where I could step through the code a line at a time OR
evaluate the
values of any variables that might be referenced there.

I have this code in the AfterUpdate of a ComboBox:

Private Sub cboProductFamily_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Product_ID] = " & Str(Nz(Me![cboProductFamily], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I understand what the code is saying just fine, but it is blowing up on
the
line that begins "rs.FindFirst". I need to find out what value it is
reading
in cboProductFamily so that I can decide what to do about it.

So the question is "What is the moral equivalent, in Access, of SET
STEP ON,
and how would I use it?"
 
M

MikeB

<Chuckle> Your surname is spelled like my surname is frequently
mispronounced: Birley!

Yours probably started out as something else.

Mine was "Bauerlie" when my Great Grandfather left the Frankfurt Germany area
in 1885.

In my hometown (pop 110 in 1950) in Indiana, everyone (at least the oldtimers)
always called us the "Barleys", which is pretty much how my father and his
father still pronounced it, even though the spelling was americanized to
Byerley.

I answer to anything close.... ;-)
 
G

Guest

Mine isn't quite that simple (see http://www.birley.org). The German origin
group of whom you speak also have a segment, based primarily in the Maryland
area, who also pronounce the name Barley, but spell it the same as mine. The
Descendants of the Birleys of Lancashire with my spelling number only about
100 families in all of North America, and I have the names and addresses of
most of them!

However, that said, to what extent have you ever messed around with
genealogy? My reason for asking is that I have helped a number of folks over
the years to get started in the "right" direction. If you email me from the
link on my website, I'd be delighted to offer any help you might like that
was within my limited skills.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top