No problem ... my fault ... my question was more in line of "Is there some way in Access to simulate the Form Wizard dialog box?" without having to do the coding shown below ... the example given below is just for Tables, ultimately, I want to take this idea to the field level using the same technique ... an input table like app could have fields that are spread across a number of other tables which normalize the input table data ... the purpose of building this manager is to simplify the data processing such that the resulting FIELD MAP can be processed using a dynamic in/out routine.
Currently, we might receive an XML flat file that might look something like
table app with fields; a, b, c, d, e1, e2, e3, f, g1, g2 ... the intent is to match/manage a field map using a Wizard style Dialog Box such that:
fields; a, b, c, d, & f populate a record in table X with corresponding fields az, bz, cz, dz & fz ... XML field names may not always be identical to the table field names
fields; e1, e2, & e3 populate 3 records in table Y with corresponding fields of az & ez
fields; g1 & g2 populate 2 records in table Z with corresponding fields of az & gz
Step 1 Create Table Reference: app references tables X, Y, Z
Step 2 Create Field Reference: app references fields a,b,c,d,f in X, a & e in Y and a & g in Z
High-level example of the Form Wizard process I am attempting to simulate: take any DB with any number of tables and create a simple form that has a list control tied to a list of tables (built from tabledef), then has 2 combo boxes that show the same list of tables minus the one selected ... then provide the 4; >, >>, <, <<, buttons that quickly allow moving tables of interest across left to right ... what I have done is create a temp table called zTbl with an additional field STA that is used to populate these two combo boxes using 2 queries
STA = 0 is the selected Table which won't show in the combo boxes
STA = 1 is the Left Combo Box
STA = 2 is the Right Combo Box
> changes 1 -> 2
< changes 2 -> 1
>> changes all 1 -> 2
<< changes all 2 -> 1
Code:
Option Compare Database
Option Explicit
Private Sub Form_Load()
clrT
Me.Form.Refresh
End Sub
Sub clrT() ' clears the Combo boxes on load or change of listbox
Dim sql As String
DoCmd.SetWarnings False
sql = "delete * from zTbl ;"
DoCmd.RunSQL sql
DoCmd.SetWarnings True
End Sub
Private Sub cbT_Change() ' load T1 Combo Box
Dim sql As String
Dim rs As DAO.Recordset
clrT
DoCmd.SetWarnings False
sql = "insert into zTbl select * FROM Tbl ;"
DoCmd.RunSQL sql
DoCmd.SetWarnings True
sql = "select * from zTbl where [tbl] = '" & Me.cbT.Value & "'"
Set rs = CurrentDb.OpenRecordset(sql)
If rs.RecordCount > 0 Then
rs.MoveFirst
rs.Edit
rs!sta = 0
rs.Update
End If
Me.Form.Refresh
End Sub
Private Sub cmA1_Click() ' >>
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("ztbl")
If rs.RecordCount > 0 Then
rs.MoveFirst
While Not rs.EOF
If rs!sta = 1 Then
rs.Edit
rs!sta = 2
rs.Update
End If
rs.MoveNext
Wend
End If
Me.Form.Refresh
End Sub
Private Sub cmA2_Click() ' <<
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("ztbl")
If rs.RecordCount > 0 Then
rs.MoveFirst
While Not rs.EOF
If rs!sta = 2 Then
rs.Edit
rs!sta = 1
rs.Update
End If
rs.MoveNext
Wend
End If
Me.Form.Refresh
End Sub
Private Sub cmS2_Click() '<
S2
End Sub
Sub S2() '<
Dim sql As String
Dim rs As DAO.Recordset
sql = "select * from zTbl where [tbl] = '" & Me.lsT2.Value & "'"
Set rs = CurrentDb.OpenRecordset(sql)
If rs.RecordCount > 0 Then
rs.MoveFirst
rs.Edit
rs!sta = 1
rs.Update
End If
Me.Form.Refresh
End Sub
Private Sub cmS1_Click() '>
S1
End Sub
Sub S1() '>
Dim sql As String
Dim rs As DAO.Recordset
sql = "select * from zTbl where [tbl] = '" & Me.lsT1.Value & "'"
Set rs = CurrentDb.OpenRecordset(sql)
If rs.RecordCount > 0 Then
rs.MoveFirst
rs.Edit
rs!sta = 2
rs.Update
End If
Me.Form.Refresh
End Sub
Private Sub lsT1_DblClick(Cancel As Integer) '>
S1
End Sub
Private Sub lsT2_DblClick(Cancel As Integer) '<
S2
End Sub