Solved mismatch in expression

TipsyWolf

Member
Local time
Today, 09:43
Joined
Mar 20, 2024
Messages
249
hey guys,
so i have Form with everything i need.
i've just created a new table
1719255773891.png


i added all these fields to my form and when i try to open it, it says 'Type mismatch in expression"
why ?
 
found mistake. RiskIDpic is now a number filed type. still have mismatch issue
 
You have bigger issues than this form error. That table is not set up properly. You should not be storing data in field names, you are doing this in by numerating your fields (1, 2, 3, etc.) and with prefixes (before/after). That data, if necessary should be stored in fields in the table, not in field names of the table. This is how the above table should be set up:

picID, autonumber, primary key
RiskIDpic, short text, my guess is foreign key, this remains
picBefore, Yes/No, Yes means it is before, no means it is after
picPath, short text, this will hold the path
picName, short text, this will hold the name
picNumber, number, this will hold the number

My guess is that picNumber may not even be necessary because you just added the numbers as a way to differentiate all those fields you had in your table. But if it is, then keep picNumber. Then with that table, to add 3 pics you would add 3 records--one for each, you wouldn't add just one record for each RiskID that held 3 pics.

That's the way that table should be set up. The form for it would then be a simple subform which would allow you to enter all that data.
 
You have bigger issues than this form error. That table is not set up properly. You should not be storing data in field names, you are doing this in by numerating your fields (1, 2, 3, etc.) and with prefixes (before/after). That data, if necessary should be stored in fields in the table, not in field names of the table. This is how the above table should be set up:

picID, autonumber, primary key
RiskIDpic, short text, my guess is foreign key, this remains
picBefore, Yes/No, Yes means it is before, no means it is after
picPath, short text, this will hold the path
picName, short text, this will hold the name
picNumber, number, this will hold the number

My guess is that picNumber may not even be necessary because you just added the numbers as a way to differentiate all those fields you had in your table. But if it is, then keep picNumber. Then with that table, to add 3 pics you would add 3 records--one for each, you wouldn't add just one record for each RiskID that held 3 pics.

That's the way that table should be set up. The form for it would then be a simple subform which would allow you to enter all that data.
thanks for your reply, plog!

this is continuation of my journey in access from this post and this one
so im gonna have 6 thumbnails (pic) in my form. 3 before. 3 after. and each of them need to have a filepath. not sure about file name, but filepath is necessary cause it will open certain pic with 1 lick.

at first i wanted to add these data to main table, but i was taught here at AWF that its not good idea to create one huge table, better make a few with relations. so i need to store in these fields a file path.

what would u recommend to me in this case ?
ty in advance

ps. i deleted everthing i added and it still gives me mismatch issue and now i can't open my form. some kinda dust is in a form ? why i can't open it even if i removed all these fields ?

UPD: i checked countrol source and removed table there and form works for me just fine :)
 
Last edited:
i think its simpler for me just to store file path in a main table, having additional 6-12 fields
 
This is just a comment on this line. "its not good idea to create one huge table, better make a few with relations. "

This is, in fact, true, but only in the sense that the outcome of a good table design is usually multiple tables, some of which are related to one another in formally identified ways. That is not the goal, per se, though. The process is a structured, principled process, not an arbitrary division of stuff into random tables.

So, the desirability of a separate table for paths for images is neither established nor contravened by the rules of Normalization. That separate table would be created if it were the result of implementing one of those rules.

Until you are firmly grounded in understanding relational table design, it's probably a good idea to postpone further interface work, which may well need to be revamped as the table design is refined.
 
will i need to see 6 thumbnails (pics) and maybe 12 if file name will do anything useful. so 6 pics, each one has its own file and path to open it.
this one
Perhaps what you want is possible using a subform with a properly normalized table structure, of course.
 
Perhaps what you want is possible using a subform with a properly normalized table structure, of course.
sometimes simple things might not be that simple for some ppl.
or how we say in my country - the closest path is the path u know of. :)
yeah, i have already subforum in my form. im gonna play with separating filepath into new table then subform and give it a play. if it will turn out hard for me or some issues- its better for me to have them in main table and populate vba code to each pic with changing _1 _2 _3

i need to have in root folder
RIskID_23_picbefore_1
RIskID_23_picbefore_2
RIskID_23_picbefore_3
RIskID_23_picafter_1
RIskID_23_picafter_2
RIskID_23_picafter_3
so it should be separate button, separate vba code.
 
Code:
what would u recommend to me in this case ?

I recommend you reread my initial recommendation.
 

Users who are viewing this thread

Back
Top Bottom