Code:
NSQL = "INSERT INTO tblOpeName (name)" & " values (" & MSQL & ")"
Error occurs here.
What i need to do is
1. Copy Unique Operator name(No duplicates) (OpeName1) from tblGage
2. Where Date equal to txtdate.text
3. Insert them into another field called Name in tblOpeName
Until this line prg works well.
Code:
OSQL = "SELECT DISTINCT OpeName1 FROM tblGage WHERE Date =" & SQLDate(txtdate.Text)
Set rss = dbs.OpenRecordset(OSQL)
MSQL = rss("OpeName1")
sqldate funtion will return txtdate.text as #txtdate.text # where suitable to sql.
OSQL vale looks like "Text"
Plz help to solve this
Thanx
Code:
Private Sub cmdsummery_Click()
Set wss = DBEngine.Workspaces(0)
Set dbs = wss.OpenDatabase("Gagedetails.mdb")
Set rss = dbs.OpenRecordset("tblGage")
Do While Not rss.EOF
OSQL = "SELECT DISTINCT OpeName1 FROM tblGage WHERE Date =" & SQLDate(txtdate.Text)
Set rss = dbs.OpenRecordset(OSQL)
MSQL = rss("OpeName1")
NSQL = "INSERT INTO tblOpeName (name)" & " values (" & MSQL & ")"
Set rss = dbs.OpenRecordset(NSQL)
rss.MoveNext
Loop
rss.Close
Set rss = Nothing
End Sub
When i tried to run this got a Error code "runtime error 3219"
plz help