Dark-Angrl
10-20-2008, 12:03 PM
Well 1 thing i realy need to firgure out how to make it work, others should go more smothly once i firgure out this one. Im trying to make at my work a database of serial numbers, the program keep track of the serial numbers to know where a certain card is to know witch one it need to print out. First thing im trying to do is to fetch the last serial number but i keep getting errors no mather what i do. here what i have now
Dim strSQL As String
Dim Table_name As Variant
Dim Last_result As Variant
Dim Bg As Variant
Dim Reponse As VbMsgBoxResult
Dim Reponse_bidon As VbMsgBoxResult
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Set db = CurrentDb()
Table_name = Me![Ibox_Card]
Bg = Chr(34)
Response = MsgBox("Do you want to generate this card " & Bg & "" & Table_name & "" & Bg & " serial numbers?", vbQuestion + vbYesNo)
If Response = vbYes Then
strSQL = "SELECT TOP 1 " & Table_name & _
" FROM " & Table_name & _
" WHERE 'Serial_Number' " & _
"ORDER BY 'Serial_Number' DESC;"
Set rst1 = db.OpenRecordset(strSQL, dbOpenDynaset)
Last_result = CVar(rst1)
Reponse_bidon = MsgBox("" & Last_result & "", vbCritical + vbOKOnly)
rst.Close
Set rst = Nothing
End If
for now im trying to test if it can fetch the last one. Depending on the errors i get i can tell the user the card doesnt exist. where Reponse_bidon it says invalide arguement. I have the impression my openrecordset isnt working as intended.
2 other thing are simple, to creat the serial number in this maner 10 number are the card number i need to add 4 digits at the end that are counted in hex, i also tag along info i have in input boxes that stay the same for each serial number. After the number are generated i need it to be shown in a form the list of serial number that are going to be printed in a special paper format "small .25 inch by 1 inch sticker that has .1 inch on each side of none usable space" once the person click print it save the data in the correct table and prints it.
First one is the one i have most difficulty with, the rest i just need some help "pointers" to get it done quickly and nicely, i can probebly firgure out most of it by surfing the net just the first one that is waisting my time.
Dim strSQL As String
Dim Table_name As Variant
Dim Last_result As Variant
Dim Bg As Variant
Dim Reponse As VbMsgBoxResult
Dim Reponse_bidon As VbMsgBoxResult
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Set db = CurrentDb()
Table_name = Me![Ibox_Card]
Bg = Chr(34)
Response = MsgBox("Do you want to generate this card " & Bg & "" & Table_name & "" & Bg & " serial numbers?", vbQuestion + vbYesNo)
If Response = vbYes Then
strSQL = "SELECT TOP 1 " & Table_name & _
" FROM " & Table_name & _
" WHERE 'Serial_Number' " & _
"ORDER BY 'Serial_Number' DESC;"
Set rst1 = db.OpenRecordset(strSQL, dbOpenDynaset)
Last_result = CVar(rst1)
Reponse_bidon = MsgBox("" & Last_result & "", vbCritical + vbOKOnly)
rst.Close
Set rst = Nothing
End If
for now im trying to test if it can fetch the last one. Depending on the errors i get i can tell the user the card doesnt exist. where Reponse_bidon it says invalide arguement. I have the impression my openrecordset isnt working as intended.
2 other thing are simple, to creat the serial number in this maner 10 number are the card number i need to add 4 digits at the end that are counted in hex, i also tag along info i have in input boxes that stay the same for each serial number. After the number are generated i need it to be shown in a form the list of serial number that are going to be printed in a special paper format "small .25 inch by 1 inch sticker that has .1 inch on each side of none usable space" once the person click print it save the data in the correct table and prints it.
First one is the one i have most difficulty with, the rest i just need some help "pointers" to get it done quickly and nicely, i can probebly firgure out most of it by surfing the net just the first one that is waisting my time.