Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code not working

Status
Not open for further replies.

shaz123

Technical User
Oct 13, 2006
60
DE

I am trying to lookup the clinder barcode inputed into Stringy1, i occordance with the latest inout for that cylinder barcode number. I the cylnder number is already delivered a message below should appear, can anyone see why this code is not wkring

StrSQ4 = DLookup("[D Status]", "tbl_Delupdate", "[Cylinder Barcode Label]='" & Stringy1 & "' AND [Date of D Status]=#" _
& DMax("[Date of D Status]", "tbl_Delupdate", "[Cylinder Barcode Label] = '" & Stringy1 & "'") & "#")
If Trim(StrSQ4 & "") = "Delivered" Then
MsgBox "Barcode Number is already delivered. Please re-check and try again", vbCritical, "Barcode Number
 
What sort of failure is this? Do you get the wrong data returned? Do you get an error message? Does your code fall over at a certain point and, if so, at what point?

Without this information your problem is difficult to diagnose.
 
Sowi aobut not explaning myself properly, it was bringing a null value. But what ive dun is looked up the date sepratly and it is now bringing up the correct value.

maxdate = DMax("[Date of D Status]", "tbl_Delupdate", "[Cylinder Barcode Label] = '" & Stringy1 & "'")

However i am now getting a error mesage saying
"Invalid use of Null"
when i the date of D status is equal to null.

The coding i have used is
Code:
  Stringy1 = InputBox("Please Enter/Scan the Cylinder Barcode Label You Wish to Deliver")
   
    If StrPtr(Stringy1) <> 0 Then
       strSQL = "SELECT * FROM [tbl_Delupdate] WHERE [Cylinder Barcode Label] = '" & Stringy1 & "' "
       StrSQ3 = DLookup("[Cylinder Barcode Label]", "tbl_Delupdate", "[Cylinder Barcode Label] ='" & Stringy1 & "'")
      StrSQ4 = "SELECT [D Status] From [tbl_Delupdate] WHERE [Cylinder Barcode Label] = '" & Stringy1 & "' "
    
    If StrSQ4 <> "" Then
        maxdate = DMax("[Date of D Status]", "tbl_Delupdate", "[Cylinder Barcode Label] = '" & Stringy1 & "'")
        MsgBox "Barcode Number is already delivered. Please re-check and try again", vbCritical, "Barcode Number"
    Else
    If StrSQ4 = "" Then
       Stringy2 = InputBox("The Cylinder/Cylinders Will Be Delivered For The Specified Date Below:-", "Spec Gas 2006, (DD / MM / YY)", Me!Text20 & "")
       Set rs = db.OpenRecordset("SELECT * From tbl_Delupdate Where [Cylinder Barcode Label] = '" & Stringy1 & "'")
   
   If rs![Cylinder Barcode Label] = Stringy1 Then
         rs.Edit
         rs![D Status] = "Delivered"
         rs![Date of D Status] = Stringy2
         rs![CustomerReturn/LindePickup] = Stringy3
         rs.Update
      
    MsgBox "Selected items have been marked as delivered for date " & Stringy2, vbInformation, "Items Changed Successfully"

  End If
  End If
  End If
  End If


If the Date oo status is empty i wanted it to able to edit the record
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top