Hello,
I have the following code and I was wondering if it could be reduced
Private Sub Form_Load()
On Error GoTo form_load_err
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("select * from [core surplus]"
prefix0 = rs("drawing # prefix"
rs.MoveNext
prefix1 = rs("drawing # prefix"
rs.MoveNext
prefix2 = rs("drawing # prefix"
rs.MoveNext
prefix3 = rs("drawing # prefix"
rs.MoveNext
...
rs.close
The code opens a table and fills in the values to a form. The names of the fields in the form are prefix1, prefix2, ...
As you can see, the code is pretty repetitive so I was wondering if there is a way to shorten it.
Thanks
I have the following code and I was wondering if it could be reduced
Private Sub Form_Load()
On Error GoTo form_load_err
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("select * from [core surplus]"
prefix0 = rs("drawing # prefix"
rs.MoveNext
prefix1 = rs("drawing # prefix"
rs.MoveNext
prefix2 = rs("drawing # prefix"
rs.MoveNext
prefix3 = rs("drawing # prefix"
rs.MoveNext
...
rs.close
The code opens a table and fills in the values to a form. The names of the fields in the form are prefix1, prefix2, ...
As you can see, the code is pretty repetitive so I was wondering if there is a way to shorten it.
Thanks