|
 |
access thread: Run Time Error 3077 instead of 3021
Message #1 by "Tammy Tappan" <GRTappan@e...> on Mon, 19 Nov 2001 20:43:39
|
|
That's the message I get now. Here's what I changed:
Removed the single quotes from the code, & change the form properties for
Data Entry from Yes to No.
I think the Data Entry property was part of the previous problem (no
current record). I'd like to leave the form to open as data entry if
possible, but still be able to search for a record?
+Tammy
Message #2 by Walt Morgan <wmorgan@s...> on Mon, 19 Nov 2001 14:45:07 -0600
|
|
You may want to consider the test:
If rs.eof and rs.bof then
'If both eof and bof are true there are no records in the recordset
endif
Message #3 by "Tammy Tappan" <GRTappan@e...> on Tue, 20 Nov 2001 02:19:57
|
|
Would this be used if I wanted to keep the form as opening in data entry, but still being able
to find the records? Or would this just solve the syntax problem?
+Tammy
> You may want to consider the test:
>
> If rs.eof and rs.bof then
> 'If both eof and bof are true there are no records in the recordset
> endif
>
>
Message #4 by Walt Morgan <wmorgan@s...> on Tue, 20 Nov 2001 06:51:20 -0600
|
|
Tammy,
The test for an empty recordset will allow you to branch in your code based
on whether or not there were any records in it. It's good practice to
anticipate likely occurrences and provide for their resolution. For example,
if your query does not return any records you could pop up a msgbox
informing the user that there is nothing to do.
Hope this helps,
Walt
Message #5 by "Tammy Tappan" <GRTappan@e...> on Tue, 20 Nov 2001 14:19:03
|
|
Actually, I'm kind of confused (like I've said before, I'm VERY new at code!). There should never
be an occurence of no return, because the user will be selecting a name from a drop down list;
the list is created from the table that the form writes to, so as a new contact is added via the
form, the info goes to the table, & the contact is added to the drop down list. I'm just trying to
get the drop down list to work - always has before, with the same code!
+Tammy
> Tammy,
>
> The test for an empty recordset will allow you to branch in your code
based
> on whether or not there were any records in it. It's good practice to
> anticipate likely occurrences and provide for their resolution. For
example,
> if your query does not return any records you could pop up a msgbox
> informing the user that there is nothing to do.
>
> Hope this helps,
>
> Walt
>
>
Message #6 by Walt Morgan <wmorgan@s...> on Tue, 20 Nov 2001 08:38:45 -0600
|
|
Tammy,
Sorry if I've misunderstood the question. Are you attempting to access your
table with DAO or ADO directly or through SQL? If DAO (which is what I use)
the .nomatch property can be checked. Are you seeking based on an index? If
so, are your keys correctly stated?
If you can post the snippet of code that is causing the problem perhaps
someone may be able to offer further help.
Again, I apologize if I've been the source of confusion.
Regards,
Walt
Message #7 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 20 Nov 2001 07:40:43 -0800
|
|
[quick point of procedure--please post the text of error messages in
addition to their numbers--not everybody who might be inclined to chime in
will have time to dig that up.]
Setting the .DataEntry property to True tells Access that you want that form
to be good *just* for data entry--you don't want to see any of the existing
records (this comes in handy sometimes when the tables are waaaay large).
To allow data entry in addition to browsing existing records you use the
.AllowAddtions prop.
HTH,
-Roy
Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487
-----Original Message-----
From: Tammy Tappan [mailto:GRTappan@e...]
Sent: Monday, November 19, 2001 12:44 PM
To: Access
Subject: [access] Run Time Error 3077 instead of 3021
That's the message I get now. Here's what I changed:
Removed the single quotes from the code, & change the form properties for
Data Entry from Yes to No.
I think the Data Entry property was part of the previous problem (no
current record). I'd like to leave the form to open as data entry if
possible, but still be able to search for a record?
+Tammy
Message #8 by "Tammy Tappan" <GRTappan@e...> on Tue, 20 Nov 2001 16:58:49
|
|
Walt - don't feel bad!! Remember - I'm the one new to VBA!!
Roy - first, let me say that I learned Access w/out using Code, knowing that the code would
make it only better, but there weren't classes yet available for that (now my job can't afford it!
I work for the State of Florida, & we've been hit hard in the revenue area because of recent
events).
Okay, so I'm using the Properties box on the form, not the VBA; I have Data Entry as yes, &
Allow Additions as yes.
The form is for filling in the info on people who have contacted a ministry (no, this db isn't job
related!). In the form header I've placed the same type of drop down box I've used on other
dbs, that allows the user to search for a particular record to make changes. The list is based
on a select statement that pulls the first & last name of each contact & puts them in the list;
the SQL is: SELECT [LastName] & ", " & [FirstName] AS Name, [tblContact].[LastName] FROM
tblContact ORDER BY [tblContact].[LastName];
Then, I added code to the drop down box so that, when a name was selected, it would display
that record (allowing for updates if needed). That code is (Member ID is the primary key):
Private Sub MemberSearch_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[MemberID] = " & Me![MemberSearch] & ""
rs.Bookmark = Me.Bookmark
End Sub
When I try to use the box, I get the Run Time error 3021: No Current Record.
If I change the form to Data Entry = No, I get the Run Time error 3077: Syntax error (comma)
in expression.
Kind of like, "darned if I do, darned if I don't" !!!
+Tammy
(ps - Roy, I'm not only impressed with your credentials, I'm honored that you consider all of our
problems worth your time!! Thanks.)
> Setting the .DataEntry property to True tells Access that you want that
form
> to be good *just* for data entry--you don't want to see any of the
existing
> records (this comes in handy sometimes when the tables are waaaay large).
> To allow data entry in addition to browsing existing records you use the
> .AllowAddtions prop.
>
> HTH,
>
> -Roy
>
> Roy Pardee
> Programmer/Analyst
> SWFPAC Lockheed Martin IT
> Extension 8487
Message #9 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 20 Nov 2001 09:15:21 -0800
|
|
I suspect you're not passing FindFirst the value you expect. If you put the
line
MsgBox "Getting ready to search for the MemberID " & Me!MemberSearch
right before the call to FindFirst, what do you see?
HTH,
-Roy
Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487
-----Original Message-----
From: Tammy Tappan [mailto:GRTappan@e...]
Sent: Tuesday, November 20, 2001 8:59 AM
To: Access
Subject: [access] RE: Run Time Error 3077 instead of 3021
Walt - don't feel bad!! Remember - I'm the one new to VBA!!
Roy - first, let me say that I learned Access w/out using Code, knowing that
the code would
make it only better, but there weren't classes yet available for that (now
my job can't afford it!
I work for the State of Florida, & we've been hit hard in the revenue area
because of recent
events).
Okay, so I'm using the Properties box on the form, not the VBA; I have Data
Entry as yes, &
Allow Additions as yes.
The form is for filling in the info on people who have contacted a ministry
(no, this db isn't job
related!). In the form header I've placed the same type of drop down box
I've used on other
dbs, that allows the user to search for a particular record to make changes.
The list is based
on a select statement that pulls the first & last name of each contact &
puts them in the list;
the SQL is: SELECT [LastName] & ", " & [FirstName] AS Name,
[tblContact].[LastName] FROM
tblContact ORDER BY [tblContact].[LastName];
Then, I added code to the drop down box so that, when a name was selected,
it would display
that record (allowing for updates if needed). That code is (Member ID is the
primary key):
Private Sub MemberSearch_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[MemberID] = " & Me![MemberSearch] & ""
rs.Bookmark = Me.Bookmark
End Sub
When I try to use the box, I get the Run Time error 3021: No Current Record.
If I change the form to Data Entry = No, I get the Run Time error 3077:
Syntax error (comma)
in expression.
Kind of like, "darned if I do, darned if I don't" !!!
+Tammy
(ps - Roy, I'm not only impressed with your credentials, I'm honored that
you consider all of our
problems worth your time!! Thanks.)
> Setting the .DataEntry property to True tells Access that you want that
form
> to be good *just* for data entry--you don't want to see any of the
existing
> records (this comes in handy sometimes when the tables are waaaay large).
> To allow data entry in addition to browsing existing records you use the
> .AllowAddtions prop.
>
> HTH,
>
> -Roy
>
> Roy Pardee
> Programmer/Analyst
> SWFPAC Lockheed Martin IT
> Extension 8487
Message #10 by "Tammy Tappan" <GRTappan@e...> on Tue, 20 Nov 2001 20:36:23
|
|
Do I put the Data Entry to yes or no?
+Tammy
(What does HTH mean?)
> I suspect you're not passing FindFirst the value you expect. If you put
the
> line
>
> MsgBox "Getting ready to search for the MemberID " & Me!MemberSearch
>
> right before the call to FindFirst, what do you see?
>
> HTH,
>
> -Roy
>
> Roy Pardee
> Programmer/Analyst
> SWFPAC Lockheed Martin IT
> Extension 8487
Message #11 by Madhu Mopuri <MMopuri@c...> on Tue, 20 Nov 2001 15:34:42 -0500
|
|
> -----Original Message-----
> From: Tammy Tappan [SMTP:GRTappan@e...]
> Sent: Tuesday, November 20, 2001 3:36 PM
> To: Access
> Subject: [access] RE: Run Time Error 3077 instead of 3021
>
> Do I put the Data Entry to yes or no?
>
> +Tammy
>
> (What does HTH mean?)
>
> > I suspect you're not passing FindFirst the value you expect. If you put
>
> the
> > line
> >
> > MsgBox "Getting ready to search for the MemberID " & Me!MemberSearch
> >
> > right before the call to FindFirst, what do you see?
> >
> > HTH,
> >
> > -Roy
> >
> > Roy Pardee
> > Programmer/Analyst
> > SWFPAC Lockheed Martin IT
> > Extension 8487
>
>
Message #12 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 20 Nov 2001 12:39:56 -0800
|
|
Data Entry should be No--you want to be able to browse existing records in
the Form's data source (unless I've misunderstood you).
Cheers,
-Roy
Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487
-----Original Message-----
From: Tammy Tappan [mailto:GRTappan@e...]
Sent: Tuesday, November 20, 2001 12:36 PM
To: Access
Subject: [access] RE: Run Time Error 3077 instead of 3021
Do I put the Data Entry to yes or no?
+Tammy
(What does HTH mean?)
> I suspect you're not passing FindFirst the value you expect. If you put
the
> line
>
> MsgBox "Getting ready to search for the MemberID " & Me!MemberSearch
>
> right before the call to FindFirst, what do you see?
>
> HTH,
>
> -Roy
>
> Roy Pardee
> Programmer/Analyst
> SWFPAC Lockheed Martin IT
> Extension 8487
Message #13 by "Tammy Tappan" <GRTappan@e...> on Sun, 25 Nov 2001 21:52:03
|
|
Okay, I did it - the message box came up, I pressed "Okay", & then the same run-time error
came up (syntax problem).
+Tammy
>
> > I suspect you're not passing FindFirst the value you expect. If you
put
> the
> > line
> >
> > MsgBox "Getting ready to search for the MemberID " & Me!MemberSearch
> >
> > right before the call to FindFirst, what do you see?
> >
> > HTH,
> >
> > -Roy
> >
> > Roy Pardee
> > Programmer/Analyst
> > SWFPAC Lockheed Martin IT
> > Extension 8487
>
>
Message #14 by brian.skelton@b... on Mon, 26 Nov 2001 11:54:31
|
|
Hi Tammy
Roy's point is that you seem to be passing the wrong value to your code.
You say that the combo box rowsource is:
SELECT [LastName] & ", " & [FirstName] AS Name,
[tblContact].[LastName] FROM
tblContact ORDER BY [tblContact].[LastName];
This populates the combobox with a list of names. Your code however is
expecting a Member ID, which, presumably, is not the name of the member?
Private Sub MemberSearch_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[MemberID] = " & Me![MemberSearch] & ""
rs.Bookmark = Me.Bookmark
End Sub
I think you need to change a few details of the combobox to get everything
to work. Change the rowsource to:
SELECT [MemberID],[LastName] & ", " & [FirstName] AS Name,
[tblContact].[LastName] FROM
tblContact ORDER BY [tblContact].[LastName];
Set the number of columns to 2, set the bound column to 1 and set the
column widths to hide the column thats displaying the member ID.
HTH
Brian
> Okay, I did it - the message box came up, I pressed "Okay", & then the
same run-time error
> came up (syntax problem).
>
> +Tammy
Message #15 by "Tammy Tappan" <GRTappan@e...> on Mon, 26 Nov 2001 13:03:37
|
|
Well, that did it to solve the run time error! However, when I select someone from the
dropdown list now, nothing happens. The new name shows in the list box, but the record
doesn't change. Now what?! =)
(What does HTH mean?)
+Tammy
> Hi Tammy
>
> Roy's point is that you seem to be passing the wrong value to your code.
>
> You say that the combo box rowsource is:
>
> SELECT [LastName] & ", " & [FirstName] AS Name,
> [tblContact].[LastName] FROM
> tblContact ORDER BY [tblContact].[LastName];
>
> This populates the combobox with a list of names. Your code however is
> expecting a Member ID, which, presumably, is not the name of the member?
>
> Private Sub MemberSearch_AfterUpdate()
> 'Find the record that matches the control.
> Dim rs As Object
>
> Set rs = Me.RecordsetClone
> rs.FindFirst "[MemberID] = " & Me![MemberSearch] & ""
> rs.Bookmark = Me.Bookmark
> End Sub
>
> I think you need to change a few details of the combobox to get
everything
> to work. Change the rowsource to:
>
> SELECT [MemberID],[LastName] & ", " & [FirstName] AS Name,
> [tblContact].[LastName] FROM
> tblContact ORDER BY [tblContact].[LastName];
>
> Set the number of columns to 2, set the bound column to 1 and set the
> column widths to hide the column thats displaying the member ID.
>
> HTH
>
> Brian
Message #16 by brian.skelton@b... on Mon, 26 Nov 2001 15:07:11
|
|
It means Hope This Helps (which, unfortunately, it didn't this time!)
As far as I can see, it should work fine now - would need to look more
closely at your database to find what's going wrong.
-Brian
> Well, that did it to solve the run time error! However, when I select
someone from the
> dropdown list now, nothing happens. The new name shows in the list box,
but the record
> doesn't change. Now what?! =)
>
> (What does HTH mean?)
>
> +Tammy
>
>
> > Hi Tammy
> >
> > Roy's point is that you seem to be passing the wrong value to your
code.
> >
> > You say that the combo box rowsource is:
> >
> > SELECT [LastName] & ", " & [FirstName] AS Name,
> > [tblContact].[LastName] FROM
> > tblContact ORDER BY [tblContact].[LastName];
> >
> > This populates the combobox with a list of names. Your code however is
> > expecting a Member ID, which, presumably, is not the name of the
member?
> >
> > Private Sub MemberSearch_AfterUpdate()
> > 'Find the record that matches the control.
> > Dim rs As Object
> >
> > Set rs = Me.RecordsetClone
> > rs.FindFirst "[MemberID] = " & Me![MemberSearch] & ""
> > rs.Bookmark = Me.Bookmark
> > End Sub
> >
> > I think you need to change a few details of the combobox to get
> everything
> > to work. Change the rowsource to:
> >
> > SELECT [MemberID],[LastName] & ", " & [FirstName] AS Name,
> > [tblContact].[LastName] FROM
> > tblContact ORDER BY [tblContact].[LastName];
> >
> > Set the number of columns to 2, set the bound column to 1 and set the
> > column widths to hide the column thats displaying the member ID.
> >
> > HTH
> >
> > Brian
|
|
 |