G
Guest
I have spent a LOT of hours trying to get this right - unsuccessfully -PLEASE
help !
I think it should be a lot simpler than it appears to be.
Form 4 combo boxes, 6 text boxes, user selects from combo boxes, types into
text boxes, including 3 x short date formatted ones. Table has fields set to
short date as well. I wish user to be able to click 'SAve' button without
filling in all of the date boxes. sql = :-
strSQL = "INSERT INTO [tblMachineDetails](" & _
"RoomID,TypeID,MakeID,ModelID,SupplierID,SerialNumber," & _
"Toner,PurchaseDate,LastServiceDate,NextServiceDate)" & _
"VALUES(" & _
"'" & Me!cboRoom & "'," & _
"'" & Me!cboType & "'," & _
"'" & Me!cboMake & "'," & _
"'" & Me!cboModel & "'," & _
"'" & Me!cboSupplier & "'," & _
"'" & Me!txtSerial & "'," & _
"'" & Me!txtToner & "'," & _
"'" & Me!txtPurchaseDate & "'," & _
"'" & Me!txtLastService & "'," & _
IIf(IsNull(Me!txtNextService), Null, " '" & Me!txtNextService & "'")
& ");"
Debug.Print "strSQL = "; strSQL
Debug result - example :- ( when I did not type anything into txtNextService
- text box)
strSQL = INSERT INTO
[tblMachineDetails](RoomID,TypeID,MakeID,ModelID,SupplierID,SerialNumber,Toner,PurchaseDate,LastServiceDate,NextServiceDate)VALUES('5','3','3','1','3','111111111','55555555','13/12/2004','13/12/2005', '');
I have tried everything I can find to get IIf line to work - tearing hair
out now. Depending on font, some of the " ' s are difficult to get right.
Any help - VERY welcome !!!
Ian
help !
I think it should be a lot simpler than it appears to be.
Form 4 combo boxes, 6 text boxes, user selects from combo boxes, types into
text boxes, including 3 x short date formatted ones. Table has fields set to
short date as well. I wish user to be able to click 'SAve' button without
filling in all of the date boxes. sql = :-
strSQL = "INSERT INTO [tblMachineDetails](" & _
"RoomID,TypeID,MakeID,ModelID,SupplierID,SerialNumber," & _
"Toner,PurchaseDate,LastServiceDate,NextServiceDate)" & _
"VALUES(" & _
"'" & Me!cboRoom & "'," & _
"'" & Me!cboType & "'," & _
"'" & Me!cboMake & "'," & _
"'" & Me!cboModel & "'," & _
"'" & Me!cboSupplier & "'," & _
"'" & Me!txtSerial & "'," & _
"'" & Me!txtToner & "'," & _
"'" & Me!txtPurchaseDate & "'," & _
"'" & Me!txtLastService & "'," & _
IIf(IsNull(Me!txtNextService), Null, " '" & Me!txtNextService & "'")
& ");"
Debug.Print "strSQL = "; strSQL
Debug result - example :- ( when I did not type anything into txtNextService
- text box)
strSQL = INSERT INTO
[tblMachineDetails](RoomID,TypeID,MakeID,ModelID,SupplierID,SerialNumber,Toner,PurchaseDate,LastServiceDate,NextServiceDate)VALUES('5','3','3','1','3','111111111','55555555','13/12/2004','13/12/2005', '');
I have tried everything I can find to get IIf line to work - tearing hair
out now. Depending on font, some of the " ' s are difficult to get right.
Any help - VERY welcome !!!
Ian