Having users enter registration keys in Microsoft Access
So my issue is that I want to have users enter their registration keys to a software into an Access table.
There are five parts to the registration key. How can I take these 5 boxes and format them to one column in the database?
(In Form: [_________________] - [_________________] - [______________开发者_StackOverflow中文版___] - [_________________] - [_________________]
In Database: "_________________ - _________________ - _________________ - _________________ - _________________"
Many thanks,
Justian
Why not just have five fields? It would be simpler for data entry/update purposes as these fields would then be found directly to the fields on the table. If you need them as one field for other purpses then in a query go soemthing like field1 & "-" & field2 & "-" & ...
Didn't really get the answer I wanted. Creating multiple fields would just spread the data to multiple columns and I'd have to make 5 different calls (in a way) to the database to get that information.
It's just too messy. I ended up putting it in one column without the separate boxes.
If you do want to go back to five textboxes on the form, you can concatenate them in VBA:
strFullRegistrationNumber = TextBox1.Value & "-" & TextBox2.Value & "-" ...
Then to do the insert:
DoCmd.RunSQL "INSERT INTO MyTable (RegistrationKey) VALUES ('" & strFullRegistrationNumber & "')"
精彩评论