He Gets a bit further by himself
- From: Andi Lee Davis <AndiLeeDavis@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Aug 2006 10:34:01 -0700
Ok I'll Leave this last one here...
Private Sub Upload_All_Click()
On Error GoTo Err_LocalError
Dim strSQL As String
Dim Location As String
Dim MenuType As String
Dim MenuDescription As String
Dim Prices As Integer
DoCmd.SetWarnings False
Location = "Forms!CreateMenus.Bar163_LocationID"
MenuType = "Forms!CreateMenus.Menu_Type"
With [Forms]![CreateMenus].[menu_frm].[Form].Recordset
..MoveFirst
Do While Not .EOF
..Edit
MenuDescription = "SELECT MenuItems.Description, Menu2Items.SelectedForWeb
FROM Menu2Items INNER JOIN MenuItems ON Menu2Items.ItemID = MenuItems.ID
WHERE
(((MenuItems.Description)=[Forms]![CreateMenus]![CreateMenusSub]![Description])AND ((Menu2Items.SelectedForWeb)=True));"
strSQL = "INSERT INTO Menu_tbl (Bar163_LocationID, Menu_Type,
Menu_Description) VALUES ( " & _
Location & " , " & MenuType & " , " & MenuDescription & ");"
DoCmd.RunSQL strSQL
..Update
..MoveNext
Loop
End With
Forms!CreateMenus!menu_frm.Requery
Exit Sub
Err_LocalError:
MsgBox Err.Description
End Sub
"Andi Lee Davis" wrote:
Ok And here I am talking to myself again....
I now have this, but it's returning and Application or Object defined
Error... Haven't a clue what this means: Here's the code so far...
Private Sub Upload_All_Click()
On Error GoTo Err_LocalError
Dim strSQL As String
Dim Location As String
Dim MenuType As String
Dim MenuDescription As String
Dim Prices As Integer
DoCmd.SetWarnings False
Location = "Forms!CreateMenus.Bar163_LocationID"
MenuType = "Forms!CreateMenus.Menu_Type"
With [Forms]![CreateMenus]![CreateMenusSub].[Form]
Do While Not .EOF
MenuDescription = "SELECT MenuItems.Description, Menu2Items.SelectedForWeb
FROM Menu2Items INNER JOIN MenuItems ON Menu2Items.ItemID = MenuItems.ID
WHERE
(((MenuItems.Description)=[Forms]![CreateMenus]![CreateMenusSub]![Description])AND ((Menu2Items.SelectedForWeb)=True));"
strSQL = "INSERT INTO Menu_tbl (Bar163_LocationID, Menu_Type,
Menu_Description) VALUES ( " & _
Location & " , " & MenuType & " , " & MenuDescription & ");"
DoCmd.RunSQL strSQL
Loop
End With
Forms!CreateMenus!menu_frm.Requery
Exit Sub
Err_LocalError:
MsgBox Err.Description
End Sub
*****************************
"Andi Lee Davis" wrote:
Ok Getting Closer.
This works on from the main Form:
Private Sub Upload_All_Click()
Dim Location As String
Dim MenuType As String
Location = "Forms!CreateMenus.Bar163_LocationID"
MenuType = "Forms!CreateMenus.Menu_Type"
MenuItem = "Forms!CreateMenus!CreateMenusSub.Description"
On Error GoTo Err_LocalError
DoCmd.SetWarnings False
Dim strSQL As String
strSQL = "INSERT INTO Menu_tbl (Bar163_LocationID, Menu_Type,
Menu_Description) VALUES ( " & _
Location & " , " & MenuType & " , " & MenuItem & " , " & MenuItem & " );"
DoCmd.RunSQL strSQL
Forms!CreateMenus!menu_frm.Requery
Exit Sub
Err_LocalError:
MsgBox Err.Description
End Sub
This works ok. Now the problem is the other subform. It does not know which
record to select so have add another control called selected for web.
How do I get it to return all the values from the list where the item is
selected for web?
Would a do while loop safice?
Any help here much appreciated.
Thanks
Andi
"Andi Lee Davis" wrote:
Hi There,
I am trying to intergrate an existing database to some web work I have done.
I have A main form for building restaurant menus where items are selected
and stored into a subform. This data is for a printable version of the menus.
However I need to Re-append this data to another table for MySQL and PHP for
the website.
The new table is also a subform:
The Data I need to Parse is:
From the Main Form called 'CreateMenus':
Bar163_Location (Unbound Combo box with List Value) = on Main Form
Menu_Type
(Unbound Combo box with List Value) = on Main Form
From the first subform called 'CreateMenusSub' which has radio filters from
the main form
Desription (Bound to a Table through a Subform on the Main Form)
Price (Bound to a Table in through Subform on the Main Form)
The Table they are to be appended to are in another subform also shown on
the Main form and I have a control button which I am testing out for just the
two controls so far. However it asks me parameter values under the data I am
looking for. Probably because the controls are unbound on the main form. I
can type any data into the dialogue boxes and this then inserts into the New
Subform.
The Event on Click has this code:
Private Sub Upload_All_Click()
On Error GoTo Err_LocalError
DoCmd.SetWarnings False
Dim strSQL As String
strSQL = "INSERT INTO Menu_tbl (Bar163_LocationID, Menu_Type) VALUES ( " & _
Forms![CreateMenus]![Bar163_LocationID] & " , " &
Forms![CreateMenus]![Menu_Type] & " );"
DoCmd.RunSQL strSQL
Exit Sub
Err_LocalError:
MsgBox Err.Description
End Sub
Can anyone help here why the values are then encapsulated into another
Parameter I have to manually type in?
Thanks
Andi
- References:
- Parsing Data from Main Form&First SubForm into New Subform
- From: Andi Lee Davis
- RE: Parsing Data from Main Form&First SubForm into New Subform
- From: Andi Lee Davis
- RE: Parsing Data from Main Form&First SubForm into New Subform
- From: Andi Lee Davis
- Parsing Data from Main Form&First SubForm into New Subform
- Prev by Date: RE: Parsing Data from Main Form&First SubForm into New Subform
- Next by Date: Using a Combo for Record Selection
- Previous by thread: RE: Parsing Data from Main Form&First SubForm into New Subform
- Next by thread: Re: Child Forms and .isLoaded
- Index(es):