VBA Code Changing Text Box Name (1 Viewer)

wilderfan

Registered User.
Local time
Yesterday, 23:01
Joined
Mar 3, 2008
Messages
172
This might be something for the Forms discussion board. But it also involves VBA coding.

I have 3 bound text boxes which I have placed in the footer section of a form. The footer section is invisible to the form user.

The user enters data into 3 unbound text boxes which are visible and then clicks on a SAVE command button to save the record.

The VBA code for the command button transfers the entries from the unbound text boxes into the invisible text boxes and saves the record.

My problem is that the VBA code keeps changing the name of one of the bound text boxes after I enter the code.

I usually put the prefix "txt" in front of Text Box names. In this case, I used the following names:

txtepisodeID
txtfunctionID
txtnameID

When I key in the VBA coding and hit enter, ACCESS capitalizes the first "E" in the text name as follows: txtEpisodeID

So I decided to rename all the Text Box names to:

txtEpisodeID
txtFunctionID
txtNameID

for the sake of consistency.

Oddy enough, the VBA coding does not allow the "F" and the "N" to be capitalized.

The coding seems to work fine, but this capitalization in some cases, but not other cases is very odd.

Does anyone have any idea why this is happening?
 

DCrake

Remembered
Local time
Today, 07:01
Joined
Jun 8, 2005
Messages
8,632
You may be duplicating names somewhere in the form be they variable names or conrol names. Check for inconsistances or duplications.

What version of Access are you using?
 

wilderfan

Registered User.
Local time
Yesterday, 23:01
Joined
Mar 3, 2008
Messages
172
I'm using ACCESS 2007.

The only explanation I can think of is this.

I started with one file and made a duplicate copy of it, salvaging parts of it so that I wouldn't have to re-create everything from scratch. Perhaps that has something to do with it.

In the VB Editor, I have checked the list of all the controls for the form. The names all seem to be appropriate.

So this is a mystery. I've attached the model as a zip file.
 

Attachments

  • Episodes2.zip
    60.5 KB · Views: 193

boblarson

Smeghead
Local time
Yesterday, 23:01
Joined
Jan 12, 2001
Messages
32,059
The names will occur based on your control names. Also, you should use

Me.txtLastName

and not just

txtLastName

as sometimes things get screwy when you don't reference the form it is comiing from, even though it is on the form.
 

wilderfan

Registered User.
Local time
Yesterday, 23:01
Joined
Mar 3, 2008
Messages
172
I'll try inserting Me. before the control name.

Thanks for the tip, Bob.
 

Users who are viewing this thread

Top Bottom