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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access 2003 to 2010; events suddenly want field names instead of control source on a form?

Status
Not open for further replies.

conneticat

Programmer
Jul 16, 2004
47
US
Finally pulling an older db into 2010...

For some reason, events aren't working properly with control sources:

For a simple example, this worked fine for years:

[Field Name] = [Control Source]:
MoneyOwed = ClassFee
MoneyPaid = Payment
OwedBalance = Balance

Private Sub LastName_LostFocus()
Me.ClassFee = Form_MainForm.ClassReg (<--NOTE: These are all control sources, not field names!)
Me.Refresh
Me.Balance = Me.ClassFee - Me.Payment
End Sub

FYI I gave these fields names different than their control sources for some strange formatting reason that I can't remember...
but it worked absolutely fine until I switched to MSAccess 2010.

Now it wants me to switch all my events to just field names:

Private Sub LastName_LostFocus()
Me.MoneyOwed = Form_MainForm.ClassReg (<--NOTE: Switched what it wanted...these are all field names, not control sources!)
Me.Refresh
Me.OwedBalance = Me.MoneyOwed - Me.MoneyPaid
End Sub

Hope this makes sense...if I have to go in and dig these all out one by one...
I'm imported this db form by form by query by query etc. because it just wasn't stable letting Access convert it. It is otherwise working OK (forms, reports, etc.)

So, how do I set something back to default to whatever it was originally? It used to be somewhat intuitive.

cat.gif
 
Your post makes on sense. I think your terminology is wrong. A control source is a field that a control is bound to (unless a calculated control). I think you mean to say these are "the control names" not the "field Names".

What do you mean "it wants me to switch"? Did Access pop up a message "Please switch"? Do you get some error? My guess is that after the import your control names are no longer the same, like when you copy and paste.
 
Huh? Did you read my post.

On forms, fields have properties, each field can have a name, as well as its designated control source. Events where I used the bound control used to work in 2003, but no longer work in 2010. Access isn't telling me anything in a popup. It's obvious when the event runs what the problem is. As for control names changing, not a bit. The forms and every calculation work fine. Just the events where I used the actual bound control instead of the name of the field. Those worked in 2003, but not 2010.

In other words, 2010 doesn't recognize control sources when field names are different. Look at the example.

cat.gif
 
Yes I read it And it maKes no sense. A field does not haVe a control source. A control has a control source and a name. The control source of a bound control is a field name. Your terminology is wrong. The visual objects on forms are controls and not fields.

When you say "it will not let me", that has no meaning for debugging. Do you get an error message? Does it not compile? Does intelligence not recognize your control names?

If in fact the name of the control is correct and not recognized by intelligence, ensure the code is compiled. Then compact and repair. If still not working then you have corruption. Either decompile or rebuild.

What happens if you use bang notation? Me!mycontrolname
 
As MajP states, you reference control names (which can be different from the source name), if however you placed the control on the form by selecting an available field from the list, it will not only assign the field to the control source but also name the control the same as the field name.

If you copy/paste a control, it may duplicate the control with the same source, but the control name will be different. You can have more than one control 'bound' to the same field, but the control names must be different.

Hope that helps.

1DMF.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top