General discussion

Locked

Data type mismach

By tariqul73 ·
Private Sub cmdCheck_Click()
Dim rs As ADODB.Recordset
Dim s As String

s = "SELECT Daybook.SlNo, Members.namess, Daybook.dates, Daybook.bookno, Daybook.recitno, Daybook.daybookno, Daybook.total, Daybook.jakat, Daybook.chaam, Daybook.hiam, Daybook.tahjadid, Daybook.wakjadid, Daybook.jalsa, Daybook.sadka, Daybook.mosjiddtc, Daybook.mosjidtg, Daybook.publication, Daybook.fitrana, Daybook.eidfund, Daybook.shotoindia, Daybook.dorbeshfund, Daybook.wasiwatjayedad, Daybook.fidiya, Daybook.alanewa, Daybook.shorteawal, Daybook.pakkhikahmodi, Daybook.rilif, Daybook.moriumsadifund, Daybook.mtai, Daybook.taherfund, Daybook.ashayetislam, Daybook.shukrana, Daybook.mid FROM Members INNER JOIN Daybook ON Members.mid = Daybook.mid where Members.namess= '" & cmbMemList.Text & "' and Daybook.dates between '#" & DTPicker1.Value & "#' and '#" & DTPicker2.Value & "#'"

Set rs = New ADODB.Recordset
rs.Open s, DC, , , adCmdText

Call RS_to_FG(rs, FG1, frmDaybook)

rs.Close
End Sub

I use Ms access date type and when I input date and click check button message is shown data type mismach

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Well at a guess

by Tony Hopkinson In reply to Data type mismach

DateTimePicker.Value isn't a string, so you can't concatentate it.

This wouldn't even compile in a static types language like C#, and it would work properly in a dynamic one, so you must be using some VB...

DateTimePicker.Value.ToString() is what you want better still.

DateTimePicker.Value.ToString("YYYY-MM-DD")

That format will always be accepted as a date and it's always unambiguous.

unlike muppet formats like
dd/mm/yyyy vs mm/dd/yyyy

A tip that will save you all sorts of grief when passing dates and numbers about is pick one of the universal formats to do it. You want to show it as

January, 15th, 2010

in a form or report, format it there.

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums