|
Prev: Search Form to search everything
Next: API HELP
From: bmelv via AccessMonster.com on 2 Jul 2008 19:06 hey, im trying to change the 'control source' of the field "balance" from the form "HSBC Form" at the click of a button... here's my code so far: Private Sub Command13_Click() [Forms]![HSBC Form]![Balance].ControlSource = 6509 End Sub when i click the button it comes up with the #Name? error, any thoughts on why this is happening? thanks, b -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200807/1
From: strive4peace on 2 Jul 2008 19:46 Hi B (what is your name?) '~~~~~~~~~~~~~~~~~~ Sub Form_ChangeControlSourceOnForm() Dim frm As form DoCmd.OpenForm "Formname", acViewDesign Set frm = Forms("Formname") frm.Balance.ControlSource = "6509" ' DoCmd.Save acForm, "Formname" DoCmd.Close acForm, "Formname" Set frm = Nothing msgbox "Done" End Sub '~~~~~~~~~~~~~~~~~~ is 6509 a fieldname? a number? Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day :) * bmelv via AccessMonster.com wrote: > hey, > im trying to change the 'control source' of the field "balance" from the form > "HSBC Form" at the click of a button... > here's my code so far: > > > Private Sub Command13_Click() > [Forms]![HSBC Form]![Balance].ControlSource = 6509 > > End Sub > > when i click the button it comes up with the #Name? error, any thoughts on > why this is happening? > > thanks, > b >
From: Douglas J. Steele on 3 Jul 2008 09:11 Actually, if 6509 is a number, you'd need frm.Balance.ControlSource = "=6509" -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "strive4peace" <strive4peace2006(a)yahoo.com> wrote in message news:OmQZb3J3IHA.4164(a)TK2MSFTNGP03.phx.gbl... > Hi B (what is your name?) > > '~~~~~~~~~~~~~~~~~~ > Sub Form_ChangeControlSourceOnForm() > Dim frm As form > DoCmd.OpenForm "Formname", acViewDesign > Set frm = Forms("Formname") > frm.Balance.ControlSource = "6509" > ' > DoCmd.Save acForm, "Formname" > DoCmd.Close acForm, "Formname" > Set frm = Nothing > msgbox "Done" > End Sub > '~~~~~~~~~~~~~~~~~~ > > is 6509 a fieldname? a number? > > Warm Regards, > Crystal > > Access Basics > 8-part free tutorial that covers essentials in Access > http://www.AccessMVP.com/strive4peace > > * > (: have an awesome day :) > * > > > > > bmelv via AccessMonster.com wrote: >> hey, >> im trying to change the 'control source' of the field "balance" from the >> form >> "HSBC Form" at the click of a button... >> here's my code so far: >> >> >> Private Sub Command13_Click() >> [Forms]![HSBC Form]![Balance].ControlSource = 6509 >> End Sub >> >> when i click the button it comes up with the #Name? error, any thoughts >> on >> why this is happening? >> >> thanks, >> b >>
From: bmelv via AccessMonster.com on 4 Jul 2008 11:30 cheers, i put that in but it came up with the error message: Run-time error 2102: The form name "[ledger]" is misspelled or refers to a From that doesn't exist. I've spelt it right and it does exist!! What i'm actually trying to do is change the RecordSource of the form [ledger] , i just thought if i could change the control source of that field first i might be able to figure how to do it on the actual form. sorry if this has confused you a bit..!!! but any ideas? cheers b p.s the names bobbie! Douglas J. Steele wrote: >Actually, if 6509 is a number, you'd need > >frm.Balance.ControlSource = "=6509" > >> Hi B (what is your name?) >> >[quoted text clipped - 41 lines] >>> thanks, >>> b -- Message posted via http://www.accessmonster.com
From: bmelv via AccessMonster.com on 4 Jul 2008 11:31
thats sposed to be 'Form' not 'From' in the error message as well!! bmelv wrote: >cheers, i put that in but it came up with the error message: > >Run-time error 2102: > >The form name "[ledger]" is misspelled or refers to a From that doesn't exist. > >I've spelt it right and it does exist!! >What i'm actually trying to do is change the RecordSource of the form [ledger] >, i just thought if i could change the control source of that field first i >might be able to figure how to do it on the actual form. sorry if this has >confused you a bit..!!! but any ideas? > >cheers >b >p.s the names bobbie! > >>Actually, if 6509 is a number, you'd need >> >[quoted text clipped - 5 lines] >>>> thanks, >>>> b -- Message posted via http://www.accessmonster.com |