S
spacejones
This is not working. I was at firstgetting a method not found when I
used db.createrecordset, now when I use db.openrecordset I get a tye
mismatch. A couple questions: am I using this function properly for
what I am doing? Also, do you see anywhere there might be a type
mismatch? I checked out all the data types in the tables and they are
all set to text. Except for NumOrdered. Any help out there? Thx.
-Chris
********Code Starts Here********
Dim mysql As String
Dim stModel As String
Dim stVer As String
Dim stCover As String
Dim stStatus As String
Dim intNum As Integer
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Rem Set rs = db.createrecordset("SELECT NumOrdered, Model, Ver,
Cover from OrderedUpHolstery ", dbOpenDynaset)
Set rs = db.OpenRecordset("OrderedUpholstery", dbOpenDynaset)
rs.MoveFirst
Do While Not rs.EOF
stModel = rs!Model
stVer = rs!Ver
stCover = rs!Cover
stStatus = rs!Status
intNum = rs!NumOrdered
For i = 1 To intNum
mysql = "INSERT INTO InventoryUp (Model, Ver, Cover,
Status) "
mysql = mysql & "SELECT stModel, stVer, stCover,
stStatus; "
DoCmd.RunSQL mysql
Next
rs.MoveNext
Loop
Set db = Nothing
Set rs = Nothing
used db.createrecordset, now when I use db.openrecordset I get a tye
mismatch. A couple questions: am I using this function properly for
what I am doing? Also, do you see anywhere there might be a type
mismatch? I checked out all the data types in the tables and they are
all set to text. Except for NumOrdered. Any help out there? Thx.
-Chris
********Code Starts Here********
Dim mysql As String
Dim stModel As String
Dim stVer As String
Dim stCover As String
Dim stStatus As String
Dim intNum As Integer
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Rem Set rs = db.createrecordset("SELECT NumOrdered, Model, Ver,
Cover from OrderedUpHolstery ", dbOpenDynaset)
Set rs = db.OpenRecordset("OrderedUpholstery", dbOpenDynaset)
rs.MoveFirst
Do While Not rs.EOF
stModel = rs!Model
stVer = rs!Ver
stCover = rs!Cover
stStatus = rs!Status
intNum = rs!NumOrdered
For i = 1 To intNum
mysql = "INSERT INTO InventoryUp (Model, Ver, Cover,
Status) "
mysql = mysql & "SELECT stModel, stVer, stCover,
stStatus; "
DoCmd.RunSQL mysql
Next
rs.MoveNext
Loop
Set db = Nothing
Set rs = Nothing