473,939 Members | 6,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot access form fields from VBA

Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.

Any suggestions?

Thanks
-Mark
Jan 8 '06 #1
6 2823
Mark wrote:
Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.

Any suggestions?


Click the builder button [...] next to the RecordSource property of the form and
examine it. I suspect that the RecordSource is a query of your query rather
than the query directly and the query actually used by the form does not have
the new fields in it.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Jan 8 '06 #2
Mark wrote:
Hello.

I have an MS Access 2000 form whose fields I need to read and
write from VBA. The fields are data-bound, using a query that has
been defined and saved in my Access database. The query uses
local data only (no external references.)

This worked fine until I added some additional fields to the
recordset. The new fields do not show up in the object browser,
and I get an error if I try to use them. This problem occurs whether
or not the new fields are bound to textboxes on the form.

The old fields continue to show up in the object browser, and I can
read and write to them from VBA as I always have.


I guess:

When you saved the form the field definitions were saved in its type
definitions. When you changed the query fields, the form definitions
were not changed.

I would try:

Remove the RecordSource; save the form; reset the RecordSource, resave
the form.
--
Lyle Fairfield
Jan 8 '06 #3
"Lyle Fairfield" <ly***********@ aim.com> wrote:

I would try:

Remove the RecordSource; save the form; reset the RecordSource, resave the
form.


Yes, that did it. I also notice that when I rebuilt the RecordSource, the
builder
created it as follows:

"SELECT qry_frm_expense s_source.* FROM qry_frm_expense s_source; "

where before I had entered only the query name itself. I'm not sure whether
this is what Rick was referring to, but thank you both for your help.

-Mark
Jan 8 '06 #4
Mark wrote:
Yes, that did it. I also notice that when I rebuilt the RecordSource, the
builder> created it as follows:

"SELECT qry_frm_expense s_source.* FROM qry_frm_expense s_source; "


I can't think of anything terribly wrong with that but it does appear a
little clumsy. Perhaps you could avoid using the builder and just type in:

qry_frm_expense s_source

--
Lyle Fairfield
Jan 8 '06 #5
I would try:
remove the RecordSource; save the form; reset the RecordSource; resave
the form.

Jan 9 '06 #6
"Lyle Fairfield" <ly***********@ aim.com> wrote:

I can't think of anything terribly wrong with that but it does appear a
little clumsy. Perhaps you could avoid using the builder and just type in:

qry_frm_expense s_source


That's what I originally had. So I guess the cure was in removing and
re-typing the recordset statement, not in modifying the statement.
As you and others suggested.
Jan 9 '06 #7

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

Similar topics

1
2600
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i access the recordset it displays the results, what the real issue is that the entry is not made into the database even though i use the Update command and i have also tried the BeginTrans and CommitTrans nothign seems to work and i am unable to...
8
5496
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
3
17993
by: Ben Schminke | last post by:
I have seen this "field cannot be updated" error on several FAQ's, and but none of the solutions seem to match my situation. I have a form based on a query. When I try to add a new record, this error comes up (twice). After I "OK" it (twice) I can add my record. However, If I add the new records directly to the queries Dynaset there are no problems or errors. I have 2 subforms on the form, but the problem persists when I delete them. ...
4
2154
by: Wayne Aprato | last post by:
I have a simple database which was originally written in Access 97. When converted to Access 2000 file format it ran flawlessly in Access 2002. I've just tried to run it in Access 2003 and I am seeing the following behaviour: Some of the fields on the continuous main form which is a list of jobs with their related details "flicker". While this is going on the form seems to function as it should and isn't locked up. If I click and hold...
2
4984
by: dskillingstad | last post by:
I'm building a tracking system and I'm having some problems. I thought this was relatively easy, but.... I have the following tables and fields (abbreviated): tblPermitMain PermitID - pk ApplicantID (from tblApplicant) PropertyID (from tblProperty) PermitNumber PermitApprovalDate
2
4684
by: dskillingstad | last post by:
I would really appreciate someone's help on this, or at least point me in the right direction.... I'm working on a permit database that contains 12 tables, and rather than list all of the tables, I'll just list a few, as the links are the same for all tables. These tables are: tblPermitMain tblApplicant tblContractor tblEngineer
2
2343
by: bbasberg | last post by:
I have been working hard to clean up my code but I am still wondering why all incoming records go to the "AddNew" part of the IF statement and never to the Edit alternative. I believe that it must be because my rs.index never really receives the value from the cell in the spreadsheet that it should use to compare to the corresponding field in the Access DB. I have named the field "rtitle" in Access and made it an index called riskIndex. I am an...
5
10288
by: Ferasse | last post by:
Hi, I'm an occasional Ms-Access developer, so there is still a lot of stuff that I don't get... Right now, I'm working on a database that stores contractual information. One of the form that I created is based on a query that links several tables. When I try to insert a record in this query-based form, I can only update the fields that are used to build relations with other tables.
0
1044
by: tedpottel | last post by:
Hi I am trying to right a script to keep a local copy of my mysql database in a local access file. I was able to do this in Access visual basic, but cannot get it to work in python. The procedure works by storing the last index value after each update. Then I do a quarry for all records with a index value bigger the the last one stored.
0
10134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11524
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11291
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10659
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9858
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.