Creating a table similar to word in access form (1 Viewer)

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
Here is my demo, I think it fakes it pretty well. Still do not really understand the utility, but it fakes a table.

So you can pick any amount of rows and up to ten columns. Here is an example
 

Attachments

  • FakeTable.accdb
    1.4 MB · Views: 66
  • 6x5.jpg
    6x5.jpg
    28.1 KB · Views: 222

Mike375

Registered User.
Local time
Tomorrow, 07:52
Joined
Aug 28, 2008
Messages
2,548
Basically you can make anything in Access but for lots of things it might take longer to make. Although after years you tend to have about everything made and just needs modifying.

One thing I find good is to have Access as the "manager" and also for data entry and then Access opens an Excel file and transfers data from the appropriate text boxes to the appropriate Excel cells.
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Thank you so much MajP :)
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Is it possible instead of having a cmd btn is to use a cbo base on selected value?
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
I am receiving no current record,

If fld.Name <> "RowNumber" Then
rs.Edit
fld = ""
rs.Update
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
Is it possible instead of having a cmd btn is to use a cbo base on selected value?

Sure just make the controls on the main form combo boxes and call the same code on the main form from the combo after updates.

Code:
  Dim frm As Form_frmFakeTable
  Set frm = Me.frmFakeTable.Form
  If IsNumeric(Me.txtRows) And IsNumeric(Me.txtColumns) Then
    frm.FormatTable Me.txtRows, Me.txtColumns
  End If

Make sure you did not delete the first row of tblGrid somehow. It needs to have a 1 in the row number column. Manually put it back.
If this idea works OK then I will update the code to be a little more robust. There is a simpler way to avoid this problem.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
This demos the combos and fixes the issue.
 

Attachments

  • FakeTable - v2.accdb
    1.4 MB · Views: 70

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
This demos the combos and fixes the issue.

Thank you so much, is it possible to do a set number of columns such as 10, and one combo box that creates the rows?
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Ok issue resolved, I thought I had 1 in rownumber. Apparently there was no record. Now I am getting Data Type Conversion Error 3421. It highlights fld = "". I am guessing I have to replace that with a matching name of my field. I was trying to look to see what matches on your form with that code. I couldn't find it.
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
is it possible to do a set number of columns such as 10, and one combo box that creates the rows?

Sure just hardwire the value you want
Code:
frm.FormatTable Me.cboRows, Me.cboColumns
to something like
Code:
frm.FormatTable Me.cboRows, 10
However if the number of columns was to be set then the code could have been written far simpler. You would not have to resize and move the columns like is currently done.

Now I am getting Data Type Conversion Error 3421. It highlights fld = ""
The fields in tblGrid are text fields. If you changed them to numeric you would get that error. If you look at the update I sent you, it simplified the code by just deleting all the records instead of leaving a record in the table. That code is no longer there.
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Sure just hardwire the value you want
Code:
frm.FormatTable Me.cboRows, Me.cboColumns
to something like
Code:
frm.FormatTable Me.cboRows, 10
However if the number of columns was to be set then the code could have been written far simpler. You would not have to resize and move the columns like is currently done.


The fields in tblGrid are text fields. If you changed them to numeric you would get that error. If you look at the update I sent you, it simplified the code by just deleting all the records instead of leaving a record in the table. That code is no longer there.

Thank you so much for your help, I will work on that right now :)
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
Hey if you get this to work and it meets your needs, can you explain its use? It is not a traditional thing you would do in Access, but if we understood the use, maybe there is a better implementation.
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Sure just hardwire the value you want
Code:
frm.FormatTable Me.cboRows, Me.cboColumns
to something like
Code:
frm.FormatTable Me.cboRows, 10
However if the number of columns was to be set then the code could have been written far simpler. You would not have to resize and move the columns like is currently done.


The fields in tblGrid are text fields. If you changed them to numeric you would get that error. If you look at the update I sent you, it simplified the code by just deleting all the records instead of leaving a record in the table. That code is no longer there.

I edited the code in your file and the cbo box isnt doing anything after the edit.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
Code:
  If IsNumeric(Me.cboRows) Then
    frm.FormatTable Me.cboRows, 10
  End If
make sure not checking cboColumns for a value.
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Yea I have written like that, still nothing. - Resolved this issue...thanks
 
Last edited:

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
I am receiving run-time error '2467' The expression you enter refers to an object that is closed or doesn't exist. The error is the text in red

Public Sub BuildTable()
Dim frm As Form_InventorySub
[Set frm = Me.InventorySub.Form
If IsNumeric(Me.cboInv) Then
frm.FormatTable Me.cboInv, 10
End If
End Sub
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
Ensure the subform control is called InventorySub. Its name may be different from the object within the subform control. Must click on very outside of control.
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
Ensure the subform control is called InventorySub. Its name may be different from the object within the subform control. Must click on very outside of control.

Yes they are called InventorySub.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 16:52
Joined
May 21, 2018
Messages
8,463
When you type this line
Set frm = Me.
Does "inventorysub" appear in the intellisense.
or if
you type INVENTORYSUB will it automatically correct to InventorySub after finishing the line?
 

Spam808

Registered User.
Local time
Today, 13:52
Joined
Dec 3, 2018
Messages
55
When you type this line
Set frm = Me.
Does "inventorysub" appear in the intellisense.
or if
you type INVENTORYSUB will it automatically correct to InventorySub after finishing the line?

Yes I it does, appear in the intellisense, that is how I know it is correct. It is still giving me that error message for some reason.
 

Users who are viewing this thread

Top Bottom