Search results

  1. R

    Insert two values from a form in a table and check if they already exist like this

    I now uploaded a sample of my database here, so you can see how everything is connected and maybe where I could have made an error. What I'm trying to do is the last step in the whole menu-navigation, so it's the last step where I need complex codes... I would be really happy if someone could...
  2. R

    Insert two values from a form in a table and check if they already exist like this

    If I adjust the code to this: Dim db As DAO.Database Dim strSQL As String Dim lngNewRecord As Long Set db = CurrentDb lngNewRecord = db.OpenRecordset("SELECT @@IDENTITY FROM tbl_PatientStudiesGroupTZP WHERE ID_PatientStudiesGroup = " & Me.ID_PatientStudiesGroup & " AND ID_TZP = 1")(0)...
  3. R

    Insert two values from a form in a table and check if they already exist like this

    Thank you for your reply! How I understand this code, the target of it would be to insert nothing, but making sure that the part... lngNewRecord = db.OpenRecordset("SELECT @@IDENTITY")(0) ... chooses the right record. And even if I "filled up" the skeleton, it didn't work properly :/
  4. R

    Insert two values from a form in a table and check if they already exist like this

    Thank you so much for your help again! But to be honest, I'm again a bit lost, because with this code, an error message occurs (Runtime-Error 3134) and says there is a syntax-error in the INSERT INTO-command. When opened with the debugger, the line db.Execute(strSQL) is highlighted. Do you have...
  5. R

    Insert two values from a form in a table and check if they already exist like this

    The code for inserting the values works now perfectly. Thank you TJPoorman! Too bad, there's another problem that arised for which I would need your expertise again! There are a couple of similar buttons on this form that only differ by the ID_TZP added to Table tbl_PatientStudiesGroupTZP (they...
  6. R

    Insert two values from a form in a table and check if they already exist like this

    Thank you so much! You saved me hours if not days of try&error work!!
  7. R

    Insert two values from a form in a table and check if they already exist like this

    Dear Community I'm not really familiar with VBA or SQL codes. Thats why I need your help! I'm trying to write some Code with the target to take a value from a textbox (out of a form) and a pregiven value (in this case = 2) and enter them in a new record in a table. But only if there is not...
Back
Top Bottom