A family of Microsoft relational database management systems designed for ease of use.
Merci Daniel. I'll try our suggestion.
Dave
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I wish to assign a Table's Record ID to Tempvar to use it in other parts of my application.
Using the SetTempVar macro, I tried assigning the tbl_Tablename.ID to the variable name, but Access 2010 will not accept it.
SetTempVar will accept static data (e.g. a number), but I can't seem to get it to accept the record ID from the table.
I am surely not the first to stumble onto this, but can't seem to find the appropriate help anywhere I've looked.
Can someone point me to an article or example?
Thanks
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Merci Daniel. I'll try our suggestion.
Dave
Hi Tom. Thanks for your swift reply. Your response makes perfect sense - the ID in the table is numeric - Auto-assigned as advised by Access. I tried to assign TempVar using the macro SetTempVar using the table name in the expression after I used another macro to get to the last record.
It looks like this SetTempVar
{Name} LastrcdID
{Expression} =[tbl_Mytable]![ID]
The response when I step through is that it doesn't recognize MyTable in the expression. It doesn't make sense to me either. If I assign a number in the expression, it accepts it, as you suggested it should.
I like the simplicity of your suggestion, assigning it in VBA, but I have shied away from getting into VBA since Macros have served me very well so far. Guess it's time for me to roll up the sleeves!
Thanks for your help.
Dave
> SetTempVar will accept static data (e.g. a number), but I can't seem to get it to accept the record ID from the table.
I don't get it. Isn't the ID value in your table static data, most likely numeric?
I don't use macros, but this one-liner in VBA would do it:
Tempvars("myTempvar") = Me.ID
Are you not doing this through your form? So, should you not be signing it the form and control name?
Just to further the concept.
SetTempVar
Name YourTempVarName
Expression =[ID]
But I also agree with Tom, don't use Macros, they had their reason for web apps, but now that those are dead use VBA. It is much more powerful and easier to work with and then you only have one place to search.