0
votes

I am working on Access 2007. I have a table with some fields in it. I had created a form from the table and one of the fields of the table is a concatenation of 2 fields from the same table.

There are 2 fields OppNo and Material in the table. I had created a form with these (and others in the table) fields. There is another field OppMat which is blank in the table. However, I had got the data into OppMat field populated as a concatenation of OppNo and Material fields in the form. I am now looking at having the table updated with the data of OppMat from the form to the same corresponding field in the table.

Kindly advise as how I could achieve this.

Thanks and regards,

1

1 Answers

0
votes

This might be possible if these cases are met:

  • The field OppMat ALWAYS has the same structure and you can assure that it does.
  • Users will not be able or very unlikely to deviate from this structure.

Notably you should use something like Left(), Right(), Mid() and so on. Whatever works best for your structure. You can use the string modifiers: https://msdn.microsoft.com/en-us/library/dd789093.aspx

On the other hand I must admit that I am sceptical if your solutions is the best. Here are my reasons:

  • Users are unpredictable and will continously deviate from your intended way to use the application.
  • Using the string functions and fixating on one structure makes your code construction inflexible, hard to maintain if changes occur and prone to errors.
  • The alternatives seem to be better with little drawback.

My suggestions for alternatives:

  • Use one textbox for each field so that you have two textboxes. You can even position them that way that it almost looks like it is continous text. But not too much otherwise the user will beconfused.
  • You can add a label that shows your concatenated fields. But for input you use two different textboxes.

Cheers!