Recent content by kevnaff

  1. K

    DLookup to return different value on MoveNext

    Hi All. I have the below code which generates an automatic email based on information from a query called QueryHiresOverdue. The correct amount of emails are being generated, however the To and CC for each email is the same. I am using a DLookup to find the To and CC for the email. Depending...
  2. K

    strSql errors

    Whilst my code is working OK. It currently updates the [Location] based on the [DepartmentBookingOut] field. In the PoolBookings form, the user selects the [DepartmentBookingOut] from a List Box. Almost all departments should be in the box, however in case they aren't, I added another field in...
  3. K

    strSql errors

    You're right. I don't know why I am not just creating a query to join the two tables. I have created a query called QueryPoolBookings with PoolBookings and ImportEquipment tables, and included all fields from PoolBookings and just the Location field from ImportEquipment. I have changed the...
  4. K

    strSql errors

    Hi cheekybuddha The command button is on the PoolBookings form. The PoolBookings table is updated as the user enters the information. The user enters the following information in to the form [CodeNo], [DepartmentBookingOut], [BookedOutBy] When they hit the Complete command button, I want it...
  5. K

    strSql errors

    The database was built by somebody else starting in 1998. I'm hoping to go through it one day and try to remove any instances of fields with spaces in them. I read somewhere that [Code No] is treated differently than if it was just [CodeNo] and putting in the parentheses would help the issue...
  6. K

    strSql errors

    Sorry DBguy. I don't know how to do this. I have removed everything and just have this code... Dim sql As String strSQL = "SELECT * FROM [ImportEquipment] WHERE ([Code No]) = " & Me.CodeNo & "" Debug.Print I have opened the Immediate Window, but don't know how to get something to show up...
  7. K

    strSql errors

    Hi Ebs. I have PoolBookings table which includes the [CodeNo] field. This table is keeping a record of any time a device is booked in and out. And each device has a unique CodeNo. All information for each device is contained in the ImportEquipment table where the [Code No] is the primary...
  8. K

    strSql errors

    Unfortunately this didn't work. I added the ; like so strSQL = "SELECT * FROM [ImportEquipment] WHERE ([Code No]) = " & Me.CodeNo & ""; and got a Syntax error.
  9. K

    strSql errors

    Hi all, I have a command button that I want to look at the table 'ImportEquipment' and find out whether [CodeNo] from the table 'PoolBookings' exists in both. If this CodeNo exists, then I want to change the [Location] field in the 'ImportEquipment' table to Me.DepartmentBookingOut At the...
  10. K

    'Next n' Looping rather than moving to the next record

    I changed to rs!barcodevalue and I can now remove the DoCmd.Requery. The snag now is that, previously it was using Me.Status = "Processed" to update the Status field in the query. Now it only updates to "Processed" for the first record. I tried changing the Me.Status to rs!Status and got a...
  11. K

    'Next n' Looping rather than moving to the next record

    Yes that's correct. I changed the Me.BarcodeValue to rs.BarcodeValue and got a 'Method or data member not found' message.
  12. K

    'Next n' Looping rather than moving to the next record

    Thanks arnelgp. I have added the End If and it works perfectly now! Without the requery, it does not change the [BarcodeValue] on the new records it creates. For example I have the following test data in my QueryBarcodeScannerReturns Without the DoCmd.Requery I get the following records...
  13. K

    'Next n' Looping rather than moving to the next record

    I have set the recordset that I am getting the BarcodeValue from as REC2 in the code below. Is this what you mean by setting it from the Recordset? The code with this change was still creating records for the same BarcodeValue. I added the DoCmd.Requery at the bottom of this code and it worked...
  14. K

    'Next n' Looping rather than moving to the next record

    Thanks Ebs. I have removed the TotalRecords part of the code and introduced the Do While Not rs.EOF and rs.MoveNext. This now loops better as it doesn't create infinite records. At the moment I have 4 test records in 'QueryBarcodeScannerReturns'. The [BarcodeValue] of each record is 00001...
  15. K

    'Next n' Looping rather than moving to the next record

    Thanks Gasman. I've not used this method before. I have put this in to my code, and have removed some extra bits that aren't required to test why the record won't move to the next one. I have also removed the REC3.Edit as you said, as this isn't required. I have introduced the Do While Not...
Back
Top Bottom