By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

Object variable not set or block width not set error

P: 1
Hi, can anyone help me before I slit my wrists?!?!

I am trying to create a procedure in an Access 97 database, that basically creates a new record in a table called "Discrepancies", with an ID number 1 digit higher than the last record in the table. The name of the ID field is "DRNo". The code I am using is as follows, but I keep getting the error message, "Object variable not set or Block Width not set". This is my code:

Dim dbWILAdb As Database, rsWILArs As Recordset, rsWILArt As Recordset, rsWILAru As Recordset

Dim DRNo As Long


'find required discrepancy number
rsWILAru.MoveLast
DRNo = rsWILAru![DR No] + 1

DoCmd.GoToRecord , , acNewRec
[DRNo] = DRNo

If anyone can hlep me sort this problem, I will be eternally grateful!

Cheers

Mark
Oct 24 '06 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
Hi, can anyone help me before I slit my wrists?!?!

...
I don't know that I can be much help, but something did catch my eye. In this code...
Expand|Select|Wrap|Line Numbers
  1.        DRNo = rsWILAru![DR No] + 1
  2.  
  3.         DoCmd.GoToRecord , , acNewRec
  4.         [DRNo] = DRNo
  5.  
Shouldn't the two highlighted field names be the same?
Oct 24 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.