Fields as buttons?
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Fields as buttons?
I have fields that have order numbes invoice numbers,
I would like them to act as a 'button' so that it opens the invoice or order form can this be done?
Thanks
I would like them to act as a 'button' so that it opens the invoice or order form can this be done?
Thanks
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
Should the user be able to edit the order number or invoice number?
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
No this is a fixed field so no editing allowed. Inovice numbers and ordernumbers cant ever be changed
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
You can use the On Click event of the text boxes, e.g.
and
Chr(34) is the double quote character.
Code: Select all
Private Sub INVOICE_NUMBER_Click()
DoCmd.OpenForm FormName:="NameOfInvoiceForm", _
WhereCondition:="INVOICE_NUMBER=" & Me.INVOICE_NUMBER
End Sub
Code: Select all
Private Sub ORDER_NUMBER_Click()
DoCmd.OpenForm FormName:="NameOfOrderForm", _
WhereCondition:="ORDER_NUMBER=" & Chr(34) & Me.ORDER_NUMBER & Chr(34)
End Sub
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
I am trying this:-
Private Sub GIN_Click()
DoCmd.OpenForm FormName:="GIN", _
WhereCondition:="GINID=" & Me.GINID
End Sub
But getting a error syantex message, what am I doing wrong?
Private Sub GIN_Click()
DoCmd.OpenForm FormName:="GIN", _
WhereCondition:="GINID=" & Me.GINID
End Sub
But getting a error syantex message, what am I doing wrong?
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
If 'privatebsub GIN_click() DoCMD is a new marco or marco group, make sure you have saved it and you have typed the name correctly
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
The code that you posted contains Private Sub, the error message contains privatebsub. Make sure that you have Private Sub.
The code should be created by selecting [Event Procedure] in the On Click event of GIN in the Data tab of the Property Sheet, then clicking the builder dots ... to the right of the dropdown arrow.
The code should be created by selecting [Event Procedure] in the On Click event of GIN in the Data tab of the Property Sheet, then clicking the builder dots ... to the right of the dropdown arrow.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
I have it as a Private Sub.
When I now enter this in the expression builder i get this message 'The expression you entered contain invalid syntax
if it helps on the SRN form on the tab collections is where the GIN field is and I want that to open the GIN form
hope that makes sense
When I now enter this in the expression builder i get this message 'The expression you entered contain invalid syntax
if it helps on the SRN form on the tab collections is where the GIN field is and I want that to open the GIN form
hope that makes sense
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
You should not enter the code in the expression builder. As mentioned in my previous reply:
The code should be created by selecting [Event Procedure] in the On Click event of GIN in the Data tab of the Property Sheet, then clicking the builder dots ... to the right of the dropdown arrow.
The code should be created by selecting [Event Procedure] in the On Click event of GIN in the Data tab of the Property Sheet, then clicking the builder dots ... to the right of the dropdown arrow.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
I think I am getting confused a little am using the expression builder.
I've attached a screen shot so you can see I am in the right area.
I've attached a screen shot so you can see I am in the right area.
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
Once again:
Click the dropdown arrow in the On Click event.
Select [Event Procedure] from the dropdown list. It's the first item in the list:
You should see [Event Procedure] in the On Click event.
Now click the "builder dots" button (with ... on it) to the right of the dropdown arrow:
This will activate the Visual Basic Editor, where you will see:
Change it so that the event procedure looks like this:
Notice that I use GINNO, since that is the name of the control and of the field. GIN should be the name of the form to be opened.
Click the dropdown arrow in the On Click event.
Select [Event Procedure] from the dropdown list. It's the first item in the list:
You should see [Event Procedure] in the On Click event.
Now click the "builder dots" button (with ... on it) to the right of the dropdown arrow:
This will activate the Visual Basic Editor, where you will see:
Change it so that the event procedure looks like this:
Code: Select all
Private Sub GINNO_Click()
DoCmd.OpenForm FormName:="GIN", WhereCondition:="GINNO=" & Me.GINNO
End Sub
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
Thank you, Sorry being a bit slow tonight:)
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
Hi
I have this command:-
Private Sub Stock_Code_Click()
DoCmd.OpenForm FormName:="Stock Control", WhereCondition:="Stock_Code=" & Me.STOCK_CODE
End Sub
But instead of going to the correct stock control form code it display's instead a blank form in stock control
Any ideas what I am doing wrong?
I have this command:-
Private Sub Stock_Code_Click()
DoCmd.OpenForm FormName:="Stock Control", WhereCondition:="Stock_Code=" & Me.STOCK_CODE
End Sub
But instead of going to the correct stock control form code it display's instead a blank form in stock control
Any ideas what I am doing wrong?
Last edited by keiath on 28 Jan 2012, 17:10, edited 1 time in total.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
Check whether the Stock Control form has its Data Entry property set to Yes. It should be set to No if you want to view/edit existing records.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Fields as buttons?
Oops - the STOCK_CODE field is text, so you should use
DoCmd.OpenForm FormName:="Stock Control", WhereCondition:="Stock_Code=" & Chr(34) & Me.STOCK_CODE & Chr(34)
DoCmd.OpenForm FormName:="Stock Control", WhereCondition:="Stock_Code=" & Chr(34) & Me.STOCK_CODE & Chr(34)
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 73
- Joined: 08 Jan 2012, 15:07
Re: Fields as buttons?
AHHHH Dam text fields lol Again thank you.
I'll have to send you an update, system is looking very good and very 'smart'
Again Thanks for all your help
I'll have to send you an update, system is looking very good and very 'smart'
Again Thanks for all your help