I inherited this....

W

WSF

Welcome to the club!
:)

WSF
Never mind.....got it (I think posting to a NG automatically starts a different line of thinking in my head)

My [Post Usage for Month Form] datasource is a two query table with one table missing its PK. Oops.

Thanks for reading!

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com

Have a section of code that I just can't figure out why its erroring...
Background: This came from an Access 2.0 app that I converted to Access 2000, and have since moved some of the tables to SQL Server, but not all.

It runs just fine if the table being updated is the original Access (2000) table, but if it is the SQL Server table, I get a "You can't go to the specified record" error at the last one.

The values at the time of the error are:
numrec = 31 (correct)
numloop = 30
acFirst = 2 (seems like acFirst would be 1)
acNext = 1 (inside the loop)

Private Sub Button32_Click()

Dim numrec As Long, numloop As Long
numrec = DCount("*", "[Post Usage for Month Form]")
numloop = 0

DoCmd.GoToRecord , , acFirst

Do Until numloop = numrec
Me![Available] = Me![Available for Next Month]
DoCmd.GoToRecord , , acNext ------this is where the debugger stops the code
numloop = numloop + 1
Loop

DoCmd.GoToRecord , , acFirst

Me![Done 2] = "Done"

End Sub

I've looked at it too long, and it must be that it is a SQL Server issue, since it works with the table in Access. As far as I can tell the table structures are identical.

Any advice is much appreciated.

Thanks!

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com
 
K

Kevin3NF

Have a section of code that I just can't figure out why its erroring...
Background: This came from an Access 2.0 app that I converted to Access 2000, and have since moved some of the tables to SQL Server, but not all.

It runs just fine if the table being updated is the original Access (2000) table, but if it is the SQL Server table, I get a "You can't go to the specified record" error at the last one.

The values at the time of the error are:
numrec = 31 (correct)
numloop = 30
acFirst = 2 (seems like acFirst would be 1)
acNext = 1 (inside the loop)

Private Sub Button32_Click()

Dim numrec As Long, numloop As Long
numrec = DCount("*", "[Post Usage for Month Form]")
numloop = 0

DoCmd.GoToRecord , , acFirst

Do Until numloop = numrec
Me![Available] = Me![Available for Next Month]
DoCmd.GoToRecord , , acNext ------this is where the debugger stops the code
numloop = numloop + 1
Loop

DoCmd.GoToRecord , , acFirst

Me![Done 2] = "Done"

End Sub

I've looked at it too long, and it must be that it is a SQL Server issue, since it works with the table in Access. As far as I can tell the table structures are identical.

Any advice is much appreciated.

Thanks!

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com
 
K

Kevin3NF

Never mind.....got it (I think posting to a NG automatically starts a different line of thinking in my head)

My [Post Usage for Month Form] datasource is a two query table with one table missing its PK. Oops.

Thanks for reading!

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com

Have a section of code that I just can't figure out why its erroring...
Background: This came from an Access 2.0 app that I converted to Access 2000, and have since moved some of the tables to SQL Server, but not all.

It runs just fine if the table being updated is the original Access (2000) table, but if it is the SQL Server table, I get a "You can't go to the specified record" error at the last one.

The values at the time of the error are:
numrec = 31 (correct)
numloop = 30
acFirst = 2 (seems like acFirst would be 1)
acNext = 1 (inside the loop)

Private Sub Button32_Click()

Dim numrec As Long, numloop As Long
numrec = DCount("*", "[Post Usage for Month Form]")
numloop = 0

DoCmd.GoToRecord , , acFirst

Do Until numloop = numrec
Me![Available] = Me![Available for Next Month]
DoCmd.GoToRecord , , acNext ------this is where the debugger stops the code
numloop = numloop + 1
Loop

DoCmd.GoToRecord , , acFirst

Me![Done 2] = "Done"

End Sub

I've looked at it too long, and it must be that it is a SQL Server issue, since it works with the table in Access. As far as I can tell the table structures are identical.

Any advice is much appreciated.

Thanks!

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com
 

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