Hello Everybody!
So I am lost, confused and at my wits’ end here
I am relatively new to Access and I ran into a quite confusing problem.
To start from the beginning: I have a form where I added a button. With this so called "editBtn" I would like to close the current form and go to another, where I can edit the record. And here is where all my problems start. I would like to only see one record on this new form, the one I selected on the previous form. (I am currently watching a Udemy tutorial on this, and it is superb, and it explains how to do all of this in general, however when I try to run it, Access gives me various types of error messages).So the line of code that the debugger highlights for me is the following:
Me.RecordSource = "SELECT qry_ElsoKor.* FROM qry_ElsoKor WHERE ((tblPersonalData.MBszám) =" & Me.OpenArgs & ");"
To explain: I have 2 tables(one is tblPersonalData), that I "sum up with a join" in one querry (gry_ElsoKor). MBszám is my PrimaryKey (in both tables). This Key is stored as a string, normally it is a barcode (like: MB158154), however at times it is only a few digits number, or a name. I tried to set the type of OpenArgs to Variant for this reason (however I also tried String before).
So, onto the main event: whenever I try to run my code, when OpenArgs is a number, I get a Type mismatch error. If OpenArgs stores a Name then the error message is syntax error. If OpenArgs is a barcode then something like parameter specification appears.
So this is my problem... I think I tried everything I am capable of with my limited knowledge. I tried to set OpenArgs as Variant, then tried SCrt(OpenArgs), tried to edit the code above, however I am totally lost.
I would really appreciate any kind of help.
Thank you in advance!
Regina
So I am lost, confused and at my wits’ end here

To start from the beginning: I have a form where I added a button. With this so called "editBtn" I would like to close the current form and go to another, where I can edit the record. And here is where all my problems start. I would like to only see one record on this new form, the one I selected on the previous form. (I am currently watching a Udemy tutorial on this, and it is superb, and it explains how to do all of this in general, however when I try to run it, Access gives me various types of error messages).So the line of code that the debugger highlights for me is the following:
Me.RecordSource = "SELECT qry_ElsoKor.* FROM qry_ElsoKor WHERE ((tblPersonalData.MBszám) =" & Me.OpenArgs & ");"
To explain: I have 2 tables(one is tblPersonalData), that I "sum up with a join" in one querry (gry_ElsoKor). MBszám is my PrimaryKey (in both tables). This Key is stored as a string, normally it is a barcode (like: MB158154), however at times it is only a few digits number, or a name. I tried to set the type of OpenArgs to Variant for this reason (however I also tried String before).
So, onto the main event: whenever I try to run my code, when OpenArgs is a number, I get a Type mismatch error. If OpenArgs stores a Name then the error message is syntax error. If OpenArgs is a barcode then something like parameter specification appears.
So this is my problem... I think I tried everything I am capable of with my limited knowledge. I tried to set OpenArgs as Variant, then tried SCrt(OpenArgs), tried to edit the code above, however I am totally lost.
I would really appreciate any kind of help.
Thank you in advance!
Regina