nuttychick
Registered User.
- Local time
- Today, 10:50
- Joined
- Jan 16, 2004
- Messages
- 84
Hi - Hope someone can help - I'm stuck!
I have an inherited database thats about 10 years old written in Access 97.
There is a cmd button that is importing data from an excel sheet into a table.
One of the fields [TBCS Code] being imported is a two digit number - always starting with 0.
The field [TBCS Code] was orgionally a text field. Changes in the orgional data source meant that this figure is no longer available as text. I have needed to change this to a numeric field in the db with a format of 00.
The import works fine now and I have the TBCS Field showing the correct figures such as 01 or 04.
However when running the following code elsewhere in the database it gives the error Datatype mismatch in criteria expression.
I'm assuming its the where clause - but I'm not that experienced with code like this, I haven't got clue what all the & mean!
Is it possible to re-write this code to manage with this new format, or do I need to start at the begining!?
Thanks
I have an inherited database thats about 10 years old written in Access 97.
There is a cmd button that is importing data from an excel sheet into a table.
One of the fields [TBCS Code] being imported is a two digit number - always starting with 0.
The field [TBCS Code] was orgionally a text field. Changes in the orgional data source meant that this figure is no longer available as text. I have needed to change this to a numeric field in the db with a format of 00.
The import works fine now and I have the TBCS Field showing the correct figures such as 01 or 04.
However when running the following code elsewhere in the database it gives the error Datatype mismatch in criteria expression.
I'm assuming its the where clause - but I'm not that experienced with code like this, I haven't got clue what all the & mean!
Is it possible to re-write this code to manage with this new format, or do I need to start at the begining!?
Thanks
Code:
MySQL = "SELECT studies.study_id, studies.Feasibility_code, studies.study_title, Actuals.[TBCS Code], Actuals.[Year/Month], tblBusinessCalendar.BusinessCalendarID, Actuals.Actual "
MySQL = MySQL + "FROM (studies INNER JOIN Actuals ON studies.Feasibility_code = Actuals.[Study Code]) INNER JOIN tblBusinessCalendar ON Actuals.[Year/Month] = tblBusinessCalendar.BusinessCalendarMonthYear "
[COLOR=DarkOrchid]MySQL = MySQL + "WHERE ((studies.study_id = " + Trim([Forms]![Study_Main].[Study_id]) + ") And ((Actuals.[TBCS Code] >= '" & "01" & "' And Actuals.[TBCS Code] <= '" & "07" & "'))) "[/COLOR]
MySQL = MySQL + "ORDER BY studies.Feasibility_code; "
Last edited: