Relationship error 3368 ?

back2basic

Registered User.
Local time
Today, 04:25
Joined
Feb 19, 2013
Messages
113
[Solved] Relationship error 3368 ?

[Solved] I have done this many times and do not understand why I am getting this error "3368" From Access 2007.

I am trying to relate the PK of a new single text field table named "manufacture" to an existing table of materials. Table materials does have a new text field named "manufacture". I get the following error: Never seen this before. Can't do it with a one-to-many relationship.

What is going on? I have also attached a .jpgof the relationships.

Any suggestions please?


Relationship must be on the same number of fields with the same data types. (Error 3368)

The CONSTRAINT clause you are using to create a relationship includes a different number of fields for each table or includes fields with different data types. Check the number of fields in the CONSTRAINT clause, check the data types of fields to make sure they match, and try again.
 

Attachments

  • Relationships.jpg
    Relationships.jpg
    89.6 KB · Views: 366
Last edited:
By looking at your relations and your narrative it is impossible to guess what, specifically, you attempted to relate. Which field with which field? The error message hints at what is wrong - did you check what it suggested you should check?

I note that your naming convention is inconsistent - read and apply this http://www.access-programmers.co.uk/forums/showthread.php?t=225837 it will make eveything easier down the road. Fix that before proceeding with any other work on this db.
 
Thank you, I solved the problem but I had to do it using the look-up & relationship option on the field pull down window when creating. I could not do it by dragging the PK over to the table as I have done in the past?

Anyhow, I agree I simply been a little afraid to break all relationships so I can rename the tables and PK's. But again I agree and will do probably at the end of the day.

Finally do you have any idea why my thread options do not show an option to post a thread as solved? I read on this but do not see the option?

Thank you once again.
 
Using lookups in tables is not recommended. It will bite you sooner or later so DON'T!

I could not do it by dragging the PK over to the table as I have done in the past?
From this brief sentence and your narratove, we deduce that you attempted to drag a field of type Long onto a field of type Text, or vice versa. Pay attention to what Access is telling you.
 
I agree and I am currently removing all lookup lists and replacing with tables and relationships.

A question about your post and please keep in mind, I don't have enough knowledge presently to explain this completely accurate but will do my best :

Am I wrong ? You can not relate two fields ( even though they are both text) as you will get a "no index found error". The PK then the sub field of the primary table must be related to the FK of the target table. I agree, you can not just drag the PK over to the target table but if I recall this does work in ver 2007? Will you please look at the attached relationships image and tell me , other then my naming convention, if you see a problem?

In any event, by simply using the lookup and relationship field option, the relation was correctly made.
 

Attachments

  • Relationships.jpg
    Relationships.jpg
    92 KB · Views: 248
Jdraw Thank you. Based on my posts you may not think I read it but I did. and you are correct, understanding was a issue. I do now understand and have corrected the DB table relationships.

Please open and tell me if it is correct now?
 

Attachments

  • Realtionships corrected.jpg
    Realtionships corrected.jpg
    89.5 KB · Views: 258
Looks better. Does it work the way you want? Are you having issues?
 
Yes, much better. The major benefit now is I can control the fields that are displayed via the column widths control. Nice! Only problem now is I don't know how to control the actual width of each column from being truncated.
 

I did but I wouldn't recommend anyone else does because the videos aren't very impressive. Dr Langer's approach to what he calls "Logic [sic] data modeling" seems very naive and/or dumbed down to the point of giving inaccurate and bad instruction. That is not so surprising by the way. The quality of education on data management varies enormously, even so it seems at reputable universities. Anyway, Langer doesn't appear to teach data management courses. Don't waste time with these videos. Buy a decent book by one of the leading data management and database design authors. e.g.: Chris Date, Terry Halpin, David Maier, Serge Abiteboul.
 
How about giving us some alternative free videos?
 
Jdraw or anyone, In correcting the DB relationships, I have jacked up the VB module. I have checked and checked the rowsource pointers, gone over all fields to be sure they have the correct variable type.......I cannot solve.

I have attached the DB (names removed to protect the innocent) . If you have a chance, please open the DB and then form "Assigned_Assets", scroll down to "widget2". This material record is marked secured column (4) . Watch the VB Code. Why does the following test "IfIsNull" fail......The field is NULL? There is nothing, I see, wrong. Even Still, the code should continue after the "Else" statement but jumps to the bottom instead of executing the code after the "Else".

I just need to get back on track

Code:
If Me.cboMaterial_ID.Column(4, Me.cboMaterial_ID.ItemsSelected) Then
   [COLOR=Red] If IsNull(Me.cboMaterial_ID.Column(9, Me.cboMaterial_ID.ItemsSelected)) Then
        serialnum = InputBox(" What is the units serial number")[/COLOR]
        strSQL = "UPDATE Materials SET Unit_Serial_No = '" & serialnum & "' WHERE Material_ID = " & Me.cboMaterial_ID
        Debug.Print strSQL
        CurrentDb.Execute strSQL, dbFailOnError
        Me.cboMaterial_ID.Requery ' Update the Combo
    End If
Else
 

Attachments

Last edited:
What exactly are you checking? I'm not following the
, Me.cboMaterial_ID.ItemsSelected)

Often the trick is to use
If Len(somevalue & "") = 0 '
' check zero length string if 0 then true
 
I do now understand and have corrected the DB table relationships.
Not quite. You need to remove the old text fields. Once you have the correct PK/FK relationships, you don't need to duplicate data.
 
I agree and I am currently removing all lookup lists and replacing with tables and relationships.

A question about your post and please keep in mind, I don't have enough knowledge presently to explain this completely accurate but will do my best :

Am I wrong ? You can not relate two fields ( even though they are both text) as you will get a "no index found error". The PK then the sub field of the primary table must be related to the FK of the target table. I agree, you can not just drag the PK over to the target table but if I recall this does work in ver 2007? Will you please look at the attached relationships image and tell me , other then my naming convention, if you see a problem?

In any event, by simply using the lookup and relationship field option, the relation was correctly made.

re the bit in bold/red

you should be able to drag one to the other - but without seeing your dbs it is not clear. however the point is that are not both text. (probably).

although the table lookup displays text, the data stored is actually a number - and the fk in the linked table therefore also needs to be a number (the same number). I never ever use table level lookups - it isn't that they are bad, per se, it's that they confuse what is really going on, and don't really save much time anyway once you are experienced in creating comboboxes.

and sometimes you really DO want to see the actual (numeric) value stored in the table - and the lookup prevents that.
 
Yes, Thank you. I posted a question about testing for Nulls on Queries Forum. Not good to test for Null's alone. PBaldy gave me a link to his Website and problem solved just as you have also explained.

The test was replaced by the following statement and all works.

Code:
If Len(Me.cboMaterial_ID.Column(9, cboMaterial_ID.ItemsSelected) & vbNullString) = 0 Then
 
Not quite. You need to remove the old text fields. Once you have the correct PK/FK relationships, you don't need to duplicate data.

Pat,
You must mean because I have both "Manufacture" and "Manufacture_ID" in the Materials table. I know ! and I am a little nervous because I am not sure how to take the next step.....because I do not have a complete understanding

Must I now populate the "Manufacture_ID" FK column then delete the Manufacture column?
 
Now That I have removed the duplicate field names in the Materials Table, all kinds of strange things are happening???

Messages about entering parameter values?
Materials_ID (FK) does not not show all of the fields anymore.?

Thought I new enough to ask a few questions and get through this. My butt has been kicked. :banghead:
 

Users who are viewing this thread

Back
Top Bottom