Recent content by Everton

  1. E

    Alphabet loop

    Thanks, I think that is certainly a more elegant way. Paul.
  2. E

    Alphabet loop

    Hello, I'd like to create a loop that will step through the letters of the alphabet, or part of it, in sequence. My first thought was to create a 1-D array called alpabet containing the letters then use: For Each letter In alphabet ..... Next I'm just wondering if anyone has thoughts on any...
  3. E

    Problems Incrementing by 1 in VBA

    I don't know if this is the best way, but I imagine it'll work: Tempa = Left(SerialNumber, 3) Tempb = Mid(SerialNumber, 4, 4) Tempc = Tempb + 1 Select Case Tempc Case Is < 10 Tempc = "000" & Tempc Case Is < 100 Tempc = "00" & Tempc Case Is < 1000 Tempc = "0" & Tempc End Select...
  4. E

    Searching in Combo Field

    Hi, Something like this might be what you're after, on the afterupdate event of the lastname control, change the rowsource of the formal fullname like this: Me.[Formal FullName].Rowsource="Select * from [Query] where lastname=" & me.[lastname] me.[Formal FullName].requery HTH, Paul.
  5. E

    Fill in value for next field

    I agree that the records need to have a unique ID, which is why the FindFirst command looks in the recorset for the record with the same value as the Primary Key field. For this to work you need to have textbox bound to the Primary Key field on your form. Providing the order of the records in...
  6. E

    Fill in value for next field

    I'm assuming you have a form based on a table or query, which you are using to input the data. If so try something like this in the afterupdate event of the Customer number text box: Private Sub Customer_number_AfterUpdate() Dim dbs As Database Dim rst As Recordset Dim curnum As Integer...
  7. E

    Toggle button to select all list items

    Hi, I am trying to create a toggle button that will select/de-select all items in a list box. At the moment I have: Private Sub selectall_Click() Select Case selectall.Value Case Yes {code to select all} Case No {code to de-select all} End select End Sub The question is, can anyone tell me...
  8. E

    Opening a recordset based on an SQL statement

    Thanks. Would this make the SQL run faster? I imagine so, but the difference for my code will probably be negligable as it will only be used for a handful of criteria at a time. Cheers, Paul.
  9. E

    Opening a recordset based on an SQL statement

    OK, Ive solved it. I have made it so the SQL reads like SELECT * FROM parts WHERE [CABLE ID]= A OR [CABLE ID]= B OR [CABLE ID]= C OR etc.. Rather than: SELECT * FROM parts WHERE [CABLE ID]= A OR B OR C OR etc.. If there is a better solution let me know. Paul.
  10. E

    Recordset

    For string criteria you need to put the data in single quotes. Try: Set RST = db.OpenRecordset("Select * From [users]where [user]= '" & Forms!usersignin!User & "'") Hope this works, Paul
  11. E

    Opening a recordset based on an SQL statement

    Hi I am trying to open a recordset based on a query, but using an SQL statement to only retrieve certain records. I am using VBA to create a string with the criteria from a list box. When the code runs, the recordset contains all the records from the "parts" query instead of just the selected...
  12. E

    Reference a field by its ordinal number

    Thanks. Paul.
  13. E

    Reference a field by its ordinal number

    Hi, I'm trying to set the values of all the fields in a recordset, and would like to reference each field by number rather than name, so I can create a loop to cycle through all fields eg: Dim rstpiklst As Recordset Set dbs = CurrentDb Set rst = dbs.OpenRecordset("MyTable", dbOpenDynaset)...
  14. E

    Can control positions be returned in VBA?

    Cheers, Paul.
  15. E

    Can control positions be returned in VBA?

    Hi, I'm trying to return the position of a label on a form using VBA. I know the top and left properties can be used to set the position, but is there any way of returning the position? What I want to do is find the position of a label then increment it by a set value after an event. Any help...
Back
Top Bottom