Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot update field on subform

Status
Not open for further replies.

twomblml

IS-IT--Management
Apr 17, 2001
42
US
Bizzare...

I have a subform where I'm updating two fields on the Before_Insert on the form. One field updates without issue. Here is the weird thing:

I created the table with a couple fields on it. One of the fields is called Master_Key. This is the field that updates properly on the Before_Insert. I needed a couple additional fields on the table so I added them. One of these new fields is the other field I want to update on the Before_Insert(same data type as Master_Key). It will not work. If I change the field to a different existing field from the original table it works. Any new field added to the table will not work.

The recordsource of the subform is the table. The field is a "Text" field as indicated on the table. The field is a string.

Why would the new fields added to the table not work? I have changed the row source to a different table, saved, then changed it back to try and reset the rowsource. It has not worked. In VB when I type Me. it brings up the list of available fields and this field appears in the list. All fields are of the same string data type.

Any ideas?

Thanks!
 
How are ya twomblml . . .

Since your talking a new record, update the [blue]DefaultValue[/blue] of the control instead!

Calvin.gif
See Ya! . . . . . .
 
I can't update any property on the control. I get

"can't find the field 'ProjectNum' referred to in your expression"

original linked tblPlanRevisions fields:

Master_Key
PlanNum
PlanName
Changes
Draftperson
RevisionDate
RevisionsPending
Rack

new fields added to linked tblPlanRevisions:

ProjectNum
Test

I update Master_Key like this:

Me.Master_Key = full_key

full_key is a string that I retrieve for a unique key.

full_key = KeyMnth & KeyDay & KeyYear & Key & strAutonumber

Try the same thing with ProjectNum

Me.ProjectNum = myProjectNum

myProjectNum is a value I am retrieving from the parent form. myProjNum = Parent.cboProjectNum

myProjNum is assigned the value properly.

Even if I do this Me.ProjectNum = "test" it fails with the "can't find the field 'ProjectNum' referred to in your expression"

Thanks!

 
I got it. Forgive me for being so blind. To create my subform I have a button on my parent that runs a SQL command. I didn't have that particular field in my SQL. I don't have the field showing on the subform so I never thought of putting it in the SQL.

All is good now.

Thanks for the suggestion.
 
And this ?
Me!ProjectNum = "test"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top