[AccessD] A2003: Access Data Project Question

Darren D darren at activebilling.com.au
Mon Sep 17 19:56:30 CDT 2007


Hi David, Charlotte

Thanks for the construct David - I ended up using it - it works well

Charlotte - Yes I am discovering this about Data Projects - very powerful beast
but - another learning curve - not too tricky but the occasional gotcha

Thanks for the replies team

Excellent
 
Darren
-----------------
T: 0424 696 433
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David Emerson
Sent: Monday, 17 September 2007 1:33 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003: Access Data Project Question

Darren,

Instead of:

     insSQL = "insert into TariffServices (TariffID, ServiceTypeCode) VALUES
(Forms!frm1_Tariff!txtTariffID,
Forms!frm3_TariffServices!cbo_luTariffServiceID)"

Try:

     insSQL = "insert into TariffServices (TariffID, ServiceTypeCode) VALUES
(" & Forms!frm1_Tariff!txtTariffID & ", " & 
Forms!frm3_TariffServices!cbo_luTariffServiceID & ")"

Regards

David

At 17/09/2007, you wrote:
>Hi All
>
>
>
>Am trying to do an insert from an Access Project form (That connects to an SQL
>2000 dB) using a Forms!Control reference and am getting the following error
>
>
>
>
>
>"Run Time Error 128 - The Name Forms! Is not permitted in this context. Only
>Constants expressions, or variables allowed here. Column Names are not
>Permitted"
>
>
>
>Clearly the old fashioned way of referencing a form control is gone in access
>Data Projects
>
>
>
>When I click help on the error - I get a white blank screen - Pretty 
>much how I
>feel :-)
>
>
>
>Any suggestions, work arounds or is there some proper way to do with with data
>Acess Projects?
>
>
>
>Many thanks
>
>
>
>Darren
>
>
>
>The code is
>
>           Dim rs As Object
>
>           Dim con As Object
>
>           Dim insSQL As String
>
>
>
>
>
>     Set rs = CreateObject("ADODB.Recordset")
>
>     Set con = Application.CurrentProject.Connection
>
>
>
>
>
>     insSQL = "insert into TariffServices (TariffID, ServiceTypeCode) VALUES
>(Forms!frm1_Tariff!txtTariffID,
>Forms!frm3_TariffServices!cbo_luTariffServiceID)"
>
>
>
>
>
>     rs.Open insSQL, con, 1, 3 '<========Fails here
>
>
>
>    ' DoCmd.RunSQL insSQL ' Also tried this and that failed too
>
>
>
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list