Creating a table similar to word in access form

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
attachment.php
 

Attachments

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.
 
Thank you so much MajP :)
 
Is it possible instead of having a cmd btn is to use a cbo base on selected value?
 
I am receiving no current record,

If fld.Name <> "RowNumber" Then
rs.Edit
fld = ""
rs.Update
 
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.
 
This demos the combos and fixes the issue.
 

Attachments

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:
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.
 
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 :)
 
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.
 
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.
 
Code:
  If IsNumeric(Me.cboRows) Then
    frm.FormatTable Me.cboRows, 10
  End If
make sure not checking cboColumns for a value.
 
Yea I have written like that, still nothing. - Resolved this issue...thanks
 
Last edited:
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
 
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.
 
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.
 
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?
 
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

Back
Top Bottom