Search results

  1. D

    Delete a record from two different tables

    Thanks Drankenneo, but I found the solution! Private Sub cmdRunQuery_Click() If MsgBox("Would you like to delete?", vbYesNo, "Confirmation") = vbYes Then Set rstDelete = CurrentDb.OpenRecordset("SELECT * FROM ManComps WHERE [Catalogue Ref] = '" & Component & "'") rstDelete.Delete Set rstDelete...
  2. D

    Delete a record from two different tables

    The tables are totally different and not connected. Every time I enter a new record in my form, the index of the text box "Component" is saved in the "Transistor" table and in the "ManComps" table. What I need to is, every time I select to delete on record from the form, my VBA code to...
  3. D

    Delete a record from two different tables

    Hi all! I have a form which contains many text boxes. What I'm doing now is that any time I create a new record I save this record to the table the form was created from and I also save to a specific field of an irrelevant table(other table) the index of one of the text boxes of this form...
  4. D

    I try to write records from a field of a query to an irrelevant table..

    Answer: Add the [Component] field to the table. In the Before_UpDate event of the form type: If (Me.NewRecord) Then _ [Component] = [TableType] & Format([Index], "00000") CurrentDb.Execute "INSERT INTO ManComps ([Catalogue Ref]) VALUES ('" & Me.[Component] & "')" Problem solved!
  5. D

    I try to write records from a field of a query to an irrelevant table..

    pr2-eugin, I have cleaned/ chopped almost everything. In the form you have: Index(type a number), Table type(you don't have to type anything), Part Ref (type anything) and the Component(it is filled automatically, as it is the combination of Index+Table type). What I want is to be able to...
  6. D

    I try to write records from a field of a query to an irrelevant table..

    Yep, I understand the statement, but it doesn't work.
  7. D

    I try to write records from a field of a query to an irrelevant table..

    I typed the expression in the On_Click event of the button but again nothing. It saves the record only to the one of the two tables (the one that was created from). In your "If..Then" expression you have an underscore after "Then". Is that correct? I don't know what can be wrong..
  8. D

    I try to write records from a field of a query to an irrelevant table..

    It seems not to work. The strange is that no error message is appeared, but the record is not saved to the ManComps table. I typed the expression in the AfterUpdate event of the form. Is that ok? The form is updated its time you go to the next/new record or when I close it.
  9. D

    I try to write records from a field of a query to an irrelevant table..

    OK...!! Initially, thanks for your reply. I have a form which is based on a query. In this form I have text boxes where I can modify/add records and save them to the relevant table of this form (the table from which my query was created). Now what I want is, the content of a specific text in...
  10. D

    I try to write records from a field of a query to an irrelevant table..

    Hi all! I have a query with many fields. One of them is the combination of two fields and is called "Components Reference". What I try to do is, every time this query is updated, the records of only this field "Components Reference" to be written to the field of another table which also takes...
  11. D

    Access choppes zeros when I combine fields of a table

    Perfect!! Thank you both of you guys!!
  12. D

    Access choppes zeros when I combine fields of a table

    Hi namliam and thanks for your reply! Where should I write this command? I tried it in the format area of the "Component" field in the query, but something goes wrong as Access itself alternates the expression to "For"m"at([I"nd"ex], 00000)" , so prabably I'm doing something wrong.
  13. D

    Access choppes zeros when I combine fields of a table

    Hi all! I have this problem two days now and couldn't find any relevant answer to my problem..anyway.. I have a table "MansComps" which includes two fields, the "Index" field which contains a number, e.g "5" and the "Tabletype" field which contains a letter e.g "T". i have created a query...
  14. D

    DCount problem

    Guys..this one looks to work fine!! I'll test it a bit more to be 100% sure..Thanks for your time!! Private Sub Form_BeforeUpdate(Cancel As Integer) Dim Street As String Dim Town As String If DCount("*", "Company", "[txtStreet]= '" & Me![Street] & "' AND [txtTown] = '" & Me![Town] & "'") > 1...
  15. D

    DCount problem

    Input1: Street name text box Input2: Town name text box statement: If (Street name & Town name) already exist in the table ..Then appear a message to the user and do not allow the new record to be saved in the table. example: Lets say my table has: Alstom Ltd , Clifton Road , London If the...
  16. D

    DCount problem

    That's my code at the moment: Private Sub Form_BeforeUpdate(Cancel As Integer) Dim Street As String Dim Town As String If DCount("*", "Company", "Street = 1 AND Town = 2") Then msg = "You already have that Street and Town combination" & vbNewLine msg = msg & "The record will now be undone"...
  17. D

    DCount problem

    Thanks jdraw! But it didn't help a lot..I know how Dlookup works..Read my posts again please. Thanks again!
  18. D

    DCount problem

    Hi pr2-eugin! Thanks for your reply! The code seems not to run at all. I have three text boxes in my form: 'txtCompanyName', 'txtStreet', 'txtTown'. My form is called 'Companyform' and my table 'Company'. There are three field in the table: 'Company Name', 'Street' and 'Town'. I want to appear a...
Top Bottom