473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

can not find field 'I'

VG
Hi folks,

I have procedure that I am using to assign ID number vs Autonumber. It
is working fine but something going wrong with my form that I have to
replace the form with old version to make it working again. It has
happened about 10 times for the last 6 month. The error message is "MS
Access can't find the field 'I' referred to in your expression. Please
advise what is going wrong. The procedure is as follows:
Private Sub Command98_Click()
On Error GoTo Err_Command98_Click

Dim NResult

DoCmd.GoToRecord , , acNewRec
NResult = DMax("[AddressID]", "Address", "")
'MsgBox NResult 'Will display maximum record in Address Table
Me.[Address ID].Value = NResult + 1
'MsgBox Me.AddressID.Value ' Will display maximum record + 1 and
display it on the current Form
Exit_Command98_Click:
Exit Sub

Err_Command98_Click:
MsgBox Err.Description
Resume Exit_Command98_Click

End Sub

Thanks,

Vadim

Apr 20 '07 #1
1 2226
On Apr 19, 5:25 pm, VG <vg-m...@telus.netwrote:
Hi folks,

I have procedure that I am using to assign ID number vs Autonumber. It
is working fine but something going wrong with my form that I have to
replace the form with old version to make it working again. It has
happened about 10 times for the last 6 month. The error message is "MS
Access can't find the field 'I' referred to in your expression. Please
advise what is going wrong. The procedure is as follows:
Private Sub Command98_Click()
On Error GoTo Err_Command98_Click

Dim NResult

DoCmd.GoToRecord , , acNewRec
NResult = DMax("[AddressID]", "Address", "")
'MsgBox NResult 'Will display maximum record in Address Table
Me.[Address ID].Value = NResult + 1
'MsgBox Me.AddressID.Value ' Will display maximum record + 1 and
display it on the current Form
Exit_Command98_Click:
Exit Sub

Err_Command98_Click:
MsgBox Err.Description
Resume Exit_Command98_Click

End Sub

Thanks,

Vadim
What do you mean "assign ID number vs Autonumber"? Either it is an
autonumber or not. You cannot assign a value to an autonumber field.
When you step thru the code in debug mode, what statement does it fail
on?

Try replacing the DMAX with something like the following (I've never
been a fan of domain statements, but not really sure why):

dim db as dao.database, r as dao.recordset
set db=currentdb
set r=db.openrecordset ("select Max(AddressID) as nResult from
Address;", dbopensnapshot)

Then you can use nResult in the same manner as your code. Be sure to
close and set to nothing when you're done.

Here's a stupid question (but it has to be asked) - Have you repaired
and compacted your database lately? If so and that has not solved
the problem, have you imported all this to a new database to see if
that solves the problem?

-- Larry Engles
- Access Developer since day 1 of Access 1.0.

Apr 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
0
by: Tim ffitch | last post by:
Hi I have a main form with some fields directly on the form and others on a page of a Tab Control. On another page of the Tab Control I have a sub form. In the On Current event of my main form I...
4
by: Chuck | last post by:
Is there anything in Access 97 that works like *Find* in Excel 97 to find a single character within a text field? Chuck ....
11
by: Pete | last post by:
Is there any way to change the default search to "Any Part Of Field" instead of whole field? The first thing I ever do when searching for something in a field is change the default setting from...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
0
by: AA Arens | last post by:
I made a find record button on my form "company" (with field for name, phone nr, e-mail etc.). I expect that when I focus on one of the field, the "look in" of the find-record dialog box should...
1
by: AA Arens | last post by:
I use the undermentioned code to find a record in a predefined "Look In" field: Private Sub Command137_Click() On Error GoTo Err_Find_Record_Click Me.CompanyName.SetFocus DoCmd.DoMenuItem...
1
by: BobM | last post by:
i read the thread entitled "Convert Field Value String to Actual Field in Expression" It appeared that the final solutions got moore complex not less complex MY PROBLEM IS: 1. get a value from...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.