Hello,
Would greatly appreciate some help with VBA. I am using the records on form1 (from Table1) to enter the data type either Text or Double in "DataType" column. There will only be 10-30 records.
When complete, I want to click a macro button that updates Table2 data types, "Field1" with ([Table1], [DataType], [ID=1] ; Field2 with ([Table1], [DataType], [ID=2]) and so on.
I have the below code that works if the data type is in the code. Can anyone help me alter this to lookup the datatype from records in Table1? (also need something to stop when there's no more records, or a loop? The Field names will be "Field" and 1 thru whatever, so is there a way to do something
??? and keep looping?
Would greatly appreciate some help with VBA. I am using the records on form1 (from Table1) to enter the data type either Text or Double in "DataType" column. There will only be 10-30 records.
When complete, I want to click a macro button that updates Table2 data types, "Field1" with ([Table1], [DataType], [ID=1] ; Field2 with ([Table1], [DataType], [ID=2]) and so on.
I have the below code that works if the data type is in the code. Can anyone help me alter this to lookup the datatype from records in Table1? (also need something to stop when there's no more records, or a loop? The Field names will be "Field" and 1 thru whatever, so is there a way to do something
Excel Formula:
IF(RIGHT(1)=[Table1], [DataType], [ID#]) Then
VBA Code:
Private Sub Command9_Click()
Dim strSQL As String
strSQL = "ALTER TABLE [Table2] ALTER COLUMN Field1 double"
DoCmd.RunSQL strSQL
strSQL = "ALTER TABLE [Table2] ALTER COLUMN Field2 double"
DoCmd.RunSQL strSQL
End Sub