G
GL
Hi,
Hope someone can solve this mystery for me! I have a numeric ID field
(NumID - not an autonumber because they need to type in). However, I need it
to go out and get the next sequential number and then set NumID to that
number when I click add. I have a field on my form (NewNumID) that finds the
MaxNumber+1 - I use a query to find the max value and add one - couldn't
think of any other way to do this, wondering if this is the problem. First I
tried a simple macro that will requery NewNumID (next available number) and
then set the value of NewNumId to NumID (field on form) - I get an error
message - "the search key was not found in any record" - doesn't make any
sense to me - I reference both fields from the form via the build command so
I know they are right.
Ideally I'd like to have it do it all when I click the add button, Requery
for the next NumID field (that doesn't work with what I have below) and then
set numid to newnumid (don't know how to do this with code). This is what I
typed but it doesn't work:
DoCmd.Save
DoCmd.Requery (NewNumID)
DoCmd.GoToRecord , , acNewRec
Hope this makes some sense!! It seems like such an easy thing to want to do
so I'm a bit frustrated that I can't figure it out! Thanks for any insight
you can provide!!
GL
Hope someone can solve this mystery for me! I have a numeric ID field
(NumID - not an autonumber because they need to type in). However, I need it
to go out and get the next sequential number and then set NumID to that
number when I click add. I have a field on my form (NewNumID) that finds the
MaxNumber+1 - I use a query to find the max value and add one - couldn't
think of any other way to do this, wondering if this is the problem. First I
tried a simple macro that will requery NewNumID (next available number) and
then set the value of NewNumId to NumID (field on form) - I get an error
message - "the search key was not found in any record" - doesn't make any
sense to me - I reference both fields from the form via the build command so
I know they are right.
Ideally I'd like to have it do it all when I click the add button, Requery
for the next NumID field (that doesn't work with what I have below) and then
set numid to newnumid (don't know how to do this with code). This is what I
typed but it doesn't work:
DoCmd.Save
DoCmd.Requery (NewNumID)
DoCmd.GoToRecord , , acNewRec
Hope this makes some sense!! It seems like such an easy thing to want to do
so I'm a bit frustrated that I can't figure it out! Thanks for any insight
you can provide!!
GL