[AccessD] A2003: Access Data Project Question

David Emerson newsgrps at dalyn.co.nz
Sun Sep 16 22:32:45 CDT 2007


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




More information about the AccessD mailing list