Darren DICK
d.dick at uws.edu.au
Sat Feb 21 17:01:00 CST 2004
Hi Stuart Thank you, Thank you, Thank you Awesome I'll never get this SQL syntax :-( < sigh> That's why I have this list :-)) Thanks again Darren ----- Original Message ----- From: "Stuart McLachlan" <stuart at lexacorp.com.pg> To: "Access Developers discussion and problemsolving" <accessd at databaseadvisors.com> Sent: Friday, February 20, 2004 2:19 PM Subject: Re: [AccessD] A2K:Data Type Mismatch in expression > This time, I'd guess that StudentID in NOT a text field, so you don't > want the two single quotes at all. > > You seem to be missing the first field name in the select statement > > You are missing a closing double quote after & "FROM tblStudents > (note you also need a space after the tblStudents and before the > double quote) > > So try: > selSQL = "SELECT tblStudents, tblStudents.StudentID " _ > & "FROM tblStudents " _ > & "WHERE (((tblStudents.StudentID)=" _ > & [Forms]![frmStudents]![txtStudentID] & "));" > > > On 20 Feb 2004 at 13:30, Darren DICK wrote: > > > Hi Guys > > This is basically the same question I asked the other day that Stuart and some others answered > > This is basically the same code (that works elsewhere by the way) copied and pasted but with a slightly > > different SQL. > > I have tried to follow (as closely as possible) the syntax that Stuart recommended with the single > > quotes and stuff, but I just cant get it right > > > > I am continually getting either "Data Type Mismatch in expression" or, depending on what I do or do not type > > "No Value give for one or more parameters" AAAAARRRRGGGHHHHH!!!!! > > > > '+++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > Dim selSQL As String > > Dim rs As Object > > Dim con As Object > > > > Set rs = CreateObject("ADODB.Recordset") > > Set con = Application.CurrentProject.Connection > > > > selSQL = "SELECT tblStudents, tblStudents.StudentID " _ > > & "FROM tblStudents & "WHERE (((tblStudents.StudentID)='" & [Forms]![frmStudents]![txtStudentID] & "'));" > > > > rs.Open selSQL, con, 1 ', 3 '<====================Debug fails here > > > > With rs > > MsgBox .RecordCount > > x = .RecordCount > > End With > > '++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > _______________________________________________ > > AccessD mailing list > > AccessD at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/accessd > > Website: http://www.databaseadvisors.com > > > -- > Lexacorp Ltd > http://www.lexacorp.com.pg > Information Technology Consultancy, Software Development,System Support. > > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com