Prev: What Formula Can I use
Next: Form Headers
From: denyoung on 1 Jun 2010 18:48 Working in Access VBA: 'Where S1Speech is a field name in an Access 2007 table called SP 'This 1st example works fine putting the value from S1Speech into the variable S1 Dim S1 as String S1= [S1Speech] ' These other 2 examples don't work Example #2 Dim S1 as String Dim TXHolder as String TXHolder = S1Speech S1=[TXHolder] Example #3 Dim S1 as String Dim TXHolder as String TXHolder = [S1Speech] S1=TXHolder Is there a way to use a variable in a situation like this? Thanks -- Dennis
From: Jeff Boyce on 1 Jun 2010 19:03 Dennis You don't mention where this code is running. It would typically be used as code-behind-form, so your use of [S1Speech] is probably pointing at the FORM, not the table. If you need to peek into the table to get values, take a look at the DLookup() function. If you want to use code-behind-form, the field will need to be available in the form. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "denyoung" <denyoung(a)discussions.microsoft.com> wrote in message news:8BDE0F99-387A-420F-BA83-0D244DF65227(a)microsoft.com... > Working in Access VBA: > > > 'Where S1Speech is a field name in an Access 2007 table called SP > 'This 1st example works fine putting the value from S1Speech into the > variable S1 > > Dim S1 as String > S1= [S1Speech] > > > ' These other 2 examples don't work > Example #2 > Dim S1 as String > Dim TXHolder as String > TXHolder = S1Speech > S1=[TXHolder] > > > Example #3 > Dim S1 as String > Dim TXHolder as String > TXHolder = [S1Speech] > S1=TXHolder > > > > Is there a way to use a variable in a situation like this? > Thanks > > -- > Dennis
|
Pages: 1 Prev: What Formula Can I use Next: Form Headers |