RecordSet: Employee ID returns ???????? (1 Viewer)

antoniocc

New member
Local time
Today, 18:14
Joined
May 13, 2012
Messages
5
Hi all,

First of all, apologies if this topic has already been addressed in another post. I appreciate your patience in advance.
I have an Employees table and I'm writing some code to store audit information based on changes done on the "Employee" form.

In VBA, I can reference all fields in my "Employee" form (I can see the content of them using immediate/watches in debug mode). However, [Forms]![Employee]![ID] always appears as "????????". Ths field is obviously filled in and the syntax should work since I'm referencing other fields without any issue.

"ID" is an AutoNumber Replication ID field - might this be the issue? Any idea of what it might be?

Many thanks in advance,
Antonio Caldas
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
Hi Antonio. Welcome to AWF!

As soon as you said "Replication ID," I also had a suspicion it might have something to do with the issue. However, you could do some tests like putting a button on your Employee form and display the Employee ID just to see if it's also going to be ????.

For example:
Code:
Private Sub TestButton_Click()
    MsgBox Me.ID
End Sub
 

antoniocc

New member
Local time
Today, 18:14
Joined
May 13, 2012
Messages
5
Hi theBDGuy, thaks for replying!
I have already tested on the Employee Form_Current() event and get the same result: ???????? (see attachment)

I have no clue what it might be and I don't want to change the Employee ID field type...



Hi Antonio. Welcome to AWF!

As soon as you said "Replication ID," I also had a suspicion it might have something to do with the issue. However, you could do some tests like putting a button on your Employee form and display the Employee ID just to see if it's also going to be ????.

For example:
Code:
Private Sub TestButton_Click()
    MsgBox Me.ID
End Sub
 

Attachments

  • Capture.JPG
    Capture.JPG
    11.4 KB · Views: 16

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
Hi theBDGuy, thaks for replying!
I have already tested on the Employee Form_Current() event and get the same result: ???????? (see attachment)

I have no clue what it might be and I don't want to change the Employee ID field type...
Sounds like we might need to do further research on ReplicationIDs. If I remember correct, they're actually GUIDs. If so, you might have to use a function to convert it into a String. By the way, the field where you're trying to record the ID, what is its data type?
 

antoniocc

New member
Local time
Today, 18:14
Joined
May 13, 2012
Messages
5
The target field is the same type: ReplicationID
But I'm not there yet, the issue is really that when reading the field in VBA I see it's content as "???????" instead of the actual field content.
I guess you are right in regards to possibly converting GUID into something else..?



Sounds like we might need to do further research on ReplicationIDs. If I remember correct, they're actually GUIDs. If so, you might have to use a function to convert it into a String. By the way, the field where you're trying to record the ID, what is its data type?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
The target field is the same type: ReplicationID
But I'm not there yet, the issue is really that when reading the field in VBA I see it's content as "???????" instead of the actual field content.
I guess you are right in regards to possibly converting GUID into something else..?
Well, if the field you're trying to save the ID is also a ReplicationID data type, then I think you wouldn't/shouldn't want to change the data type of the original data, like into a String, because you'll then probably get a type mismatch error.

More than likely, since GUID is, I guess, technically an object, then you can't just use a Forms!FormName.ID syntax to pass it around. You might have to create a function to handle the "object" to move it around.

Just a thought...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
The target field is the same type: ReplicationID
But I'm not there yet, the issue is really that when reading the field in VBA I see it's content as "???????" instead of the actual field content.
I guess you are right in regards to possibly converting GUID into something else..?
Hopefully, this article helps.

 

antoniocc

New member
Local time
Today, 18:14
Joined
May 13, 2012
Messages
5
Hi theBDGuy,

This definitely helped! I managed to get the correct GUID in string format and can now manipulate it.

Many thanks for your help!

Regards,
Antonio

 

antoniocc

New member
Local time
Today, 18:14
Joined
May 13, 2012
Messages
5
I wanted to set this thread as Solved but can't find the option...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
Hi theBDGuy,

This definitely helped! I managed to get the correct GUID in string format and can now manipulate it.

Many thanks for your help!

Regards,
Antonio
Hi Antonio. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:14
Joined
Oct 29, 2018
Messages
13,696
I wanted to set this thread as Solved but can't find the option...
To mark a thread as "solved," there's a menu at the top. If you don't see it, you may have to click on a dropdown arrow first.
 

Users who are viewing this thread

Top Bottom