Q
quixote
Jen,
I have cut this down quite a bit. Here is the function. It
popilautes tblTraveller. But I need all the records in
another table to pass through the function...not sure how
to handle it..thanks:
Public Function GetLetter(Com, Model, LineItem, PO, Qty)
Dim db As DAO.Database
Dim strSQLA As String
Dim strSQLB As String
Set db = CurrentDb
If LineItem < 10 Then
Select Case Qty
Case 1
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "A" & "')"
db.Execute strSQLA
Case 2
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "A" & "')"
strSQLB = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "B" & "')"
db.Execute strSQLA
db.Execute strSQLB
End Select
End If
If LineItem > 9 Then
Select Case Qty
Case 1
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "A" & "')"
db.Execute strSQLA
Case 2
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "A" & "')"
strSQLB = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "B" & "')"
db.Execute strSQLA
db.Execute strSQLB
End Select
End If
End Function
I have cut this down quite a bit. Here is the function. It
popilautes tblTraveller. But I need all the records in
another table to pass through the function...not sure how
to handle it..thanks:
Public Function GetLetter(Com, Model, LineItem, PO, Qty)
Dim db As DAO.Database
Dim strSQLA As String
Dim strSQLB As String
Set db = CurrentDb
If LineItem < 10 Then
Select Case Qty
Case 1
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "A" & "')"
db.Execute strSQLA
Case 2
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "A" & "')"
strSQLB = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO & "0" &
LineItem & "B" & "')"
db.Execute strSQLA
db.Execute strSQLB
End Select
End If
If LineItem > 9 Then
Select Case Qty
Case 1
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "A" & "')"
db.Execute strSQLA
Case 2
strSQLA = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "A" & "')"
strSQLB = "INSERT INTO tblTraveller (COM, Model,
Traveller)" _
& "VALUES('" & Com & "', '" & Model & "', ' " & PO &
LineItem & "B" & "')"
db.Execute strSQLA
db.Execute strSQLB
End Select
End If
End Function