Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Including sales Order number in menu accessed from (97)

    My main menu includes a drop down list where you can choose a particular sales order by sales order number. I'm adding a button which allows you to show another menu, I've added a piece of code that stops you from opening this second menu if a sales order number isn't chosen and now I'm having difficulty trying to display the sales order number selected in text in the corner of the new menu- can anyone help with this? I would be really grateful for some help, thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    What do you mean by "menu"? Are you talking about the menu bar at the top of the Access application window, or do you mean a form that acts as menu?

    If it is a form, and if the second menu is on another form, and assuming that you don't close the main menu, you can use a text box with a control source of the form

    =Forms!frmMainMenu!cboSalesOrderNumber

    where frmMainMenu is the name of the main menu form, and cboSalesOrderNumber is the name of the combo box (dropdown list) from which the user selects a sales order number.

    Post back if your situation is different.

  3. #3
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    Yeh, sorry I did mean a form acting as a main menu, I put in that piece of code that you gave me as a control source, but its still coming up #NAME?, have no idea why.

  4. #4
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    that works perfect, thanks!

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    What was the difference that made it work? (Perhaps others can profit from your experience)

  6. #6
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    The difference was I'm careless and was using the name frmMainMenu when I'd actually named the form frmMain Menu, with a spcae!! Sorry bout that!

    I do have another question though that is slightly different, if you could help me with it that would be great.

    What I want to do in this second menu is create a table by pressing a comand button. The button, presumably, will run a make table query, what I want it to do is search through a spectific field (I'll call it 'X') in an existing table (that has the name of the selected sales order). The field is a Yes/No field, linked to a checkbox. If the check box is ticked, I want this row to be included in the table. Any ideas on how to do this. Thanks again!

  7. #7
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    Hi Hans, thanks for that, I tried putting that piece of code behind the Maketable command button and I got the following error message:

    Query Input must contain at least one table or query

    Would you have any idea what the problem is? Thanks

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    <P ID="edit" class=small>(Edited by HansV on 23-Jul-03 15:39. Corrected mistake in code. Additions in italics.)</P>You can create the SQL for the make-table query in code, then execute it using DoCmd.RunSQL. The following code will do this; I have assumed that 'X' is a fixed name, that the name of the table to be created is in a text box named txtSalesOrder, and that the source table is named tblSource. Adapt as needed.

    Public Sub cmdMakeTable_Click()
    Dim strSQL As String
    strSQL = "SELECT * INTO [" & Me.txtSalesOrder & "] FROM tblSource WHERE [X] = True"
    DoCmd.RunSQL strSQL
    End Sub

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    Please excuse me, I typed the code without actually trying it, relying on obviously faulty memory.

    I forgot to state where the records come from. If the records come from a table named tblSource, the SQL string becomes

    strSQL = "SELECT * INTO [" & Me.txtSalesOrder & "] FROM [tblSource] WHERE [X] = True"

    Instead of the name of a table, you can also use the name of a query. Again, sorry about the confusion. I have corrected my previous reply

  10. #10
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    Thanks, the only problem I have is that the source table is also called by the sales order number, do you know is there any way I could Call the new table to be created somehting like 12345_X where 12345 is the sales order number

    thanks!

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    Try

    strSQL = "SELECT * INTO [" & Me.txtSalesOrder & "_X] FROM [" & Me.txtSalesOrder & "] WHERE [X] = True"

    Of course, you must replace txtSalesOrder and X by the actual names.

  12. #12
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    thanks, thats creating a table for me grand but its including all the rows in the table for that sales order number, I want it to only include the rows where hte yes/no field 'X' thats linked to a checkbox is ticked?

  13. #13
    Lounger
    Join Date
    Jul 2003
    Location
    Dublin, Ireland, Republic of
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Including sales Order number in menu accessed from (97)

    sorry, also forgot to mention that now, when I click the button it prompts me to enter a parameter value for the field 'X'

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    Throughout this thread I have always assumed that 'X' is a field in the source table, i.e. in the table whose name is the Sales Order Number. Is that not correct?

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Including sales Order number in menu accessed from (97)

    Also see the thread starting at <post#=274170>post 274170</post#>, in particular <post#=277365>post 277365</post#>. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •