Adding Fields to Form

  • Thread starter Thread starter Mat_J
  • Start date Start date
M

Mat_J

Guest
I'm a little confused about something that is happening in my Form. I have a form being supplied with Data from a Recordsource which includes records that don't have physical controls on the form, and are instead modified through VBA code when with events.

Now, I just modified my table to include an additional field, and I'd like to do the same thing I'm doing with my other fields (refer to them programmatically, but not need to display it on the form). I've included the field in the select statement of my recordsource, but I am incapable of referring to it, even though I can refer to other fields that aren't bound to controls. I believe those were created with controls, and deleted later when I realized I didn't need to see them.

This has stumped me for the past hour. All declarations of the RecordSource include this field, but I can't seem to reference it. Any ideas on how to fix it?

Thanks in advance,


Mat
 
Mat_J

If you have the field added to your table, you should be able to refer to it with code.
Maybe try compacting your db.

Tom
 
Better Explanation

I probably didn't explain very well. Here goes again - I can refer to the table data, but its the form data thats the problem.

Heres the example.

I had a table, looking something like this:

Table1(Field1, Field2, Field3, Field4)

On the form I'm using, I connect to my data with the following recordset:
Select Field1, Field2, Field3, Field4 From Table1 Where ....

Now, my form only contained 3 physical Controls. Field1 is bound to Control1, Field2 is bound to Control2 and Field3 is bound to Control3.

In this, there was no control for Field4. In my code though, I was able to refer to the recordset using Me.Field4 = Whatever. This set the table data to whatever I wanted to.

Thats how it was.

Now, I realized I needed more information in my table, and added Field5 to my table. But as with Field 4, I didn't want to see a physical control on the form I'm using. I added Field5 to the Select statement so that it now read:

Select Field1, Field2, Field3, Field4, Field5 From Table1 Where ....

But unlike Field4, my program doesn't seem able to refer to Field5 the same way as I can deal with Field4. This is the part I don't understand.

I know that the initial setup was generated with a wizard, so I was thinking it was possible that Field4 is associated somehow with the form. It is actually visible in the Object explorer under Form1, but Field5 isn't. Can anybody explain to me how to be able to see that?

Thanks very much, and I hope that made more sense then the first one.
 
Mat_J

If you go to table1 and enter another field (field5), then...
when you open the associated form in design view,
field5 will be in the 'field list'. (from the view menu>>field list)

I understand you to say this is not happening.

Mmmm....

Try associating your form to another table, or just un-associate from table1.
(change the form's record source)
Save the form.
Then re-associate to table1.
(make the form's record source table1 again)

Tom
 

Users who are viewing this thread

Back
Top Bottom