Hello,
I have build databases before but they were simple ones. I am having difficulties with this one. If someone could assist me it would be greatly appreciated. I have two issues I am not able to solve. My first questions is can a combo box be created to list hyperlinks (particularly to web sites). What I have done is created a table with a list of hyperlinks which goes to different web sites. When I open the table the links works. When I try to add the list to my main form as a combo box the links do not work. From the drop down menu when I try to click on one of the links it does not work.
The second issue I have is I have a main form which contains users account number, name, dept. etc. On this I would like to add a combo box (created from a table) to the main form which gives the users option to select from the drop down list. Once they make the selection from the combo box I would like the user’s acct#, name, and the option they selected from the list to transfer to another table. Once it is transferred I would like for that acct#, name, and dept to no longer be available on the main form. I think it has to be an append query but I have had no luck trying to set thais up. Any help would be greatly appreciated. If what I am asking is crazy please let me know.
Thank you,
JC21
20 7112 MMcCarthy 14,534
Recognized Expert Moderator MVP
Hello,
I have build databases before but they were simple ones. I am having difficulties with this one. If someone could assist me it would be greatly appreciated. I have two issues I am not able to solve. My first questions is can a combo box be created to list hyperlinks (particularly to web sites). What I have done is created a table with a list of hyperlinks which goes to different web sites. When I open the table the links works. When I try to add the list to my main form as a combo box the links do not work. From the drop down menu when I try to click on one of the links it does not work.
In the combo box properties under the format tab there is a property at the end of the list called Is Hyperlink. Set this to Yes
The second issue I have is I have a main form which contains users account number, name, dept. etc. On this I would like to add a combo box (created from a table) to the main form which gives the users option to select from the drop down list. Once they make the selection from the combo box I would like the user’s acct#, name, and the option they selected from the list to transfer to another table. Once it is transferred I would like for that acct#, name, and dept to no longer be available on the main form. I think it has to be an append query but I have had no luck trying to set thais up. Any help would be greatly appreciated. If what I am asking is crazy please let me know.
Create a field to put some kind of a trigger on the records available for the form. For example a checkbox field called UnAvail and default it to 0 (for unchecked).
Change the record source for your form to only return records where UnAvail=0.
In the AfterUpdate event of the combo box put the following: -
-
Private Sub comboboxname_AfterUpdate()
-
-
'assuming all values are available on the form
-
DoCmd.RunSQL "INSERT INTO TableName(acct#, name, dept) " & _
-
"VALUES (" & Me.[acct#] & ",'" & Me.[name] & "','" & Me.comboboxname & "')"
-
'assuming acct# is the primary key i.e. no duplicate values
-
DoCmd.RunSQL "UPDATE TableNameOfFormRecordSource SET UnAvail=-1 " & _
-
"WHERE [acct#]=" & Me.[acct#] & ";"
-
Me.Requery ' this will requery the form
-
-
End Sub
-
-
First let me start by saying thank you for quick reply. I tried what you mentioned but I think I may be missing a few points. For the Combo box I did change the property for the hyperlink to Yes but it still did not work. For the table I use for the combo box I have 2 fields one is the name of the Comp. (data type: text), the other is the address (Data type hyperlink). I have tried both as the selected field for the combo box but it did not work.
If I am missing something please let me know.
For the second question I have to say I am not that familiar with checkboxes. How do I set the checkbox field to default to 0? For the form the Record Source is a query where it is getting the info. How to I change the record source to only return records where UnAvail=0. The code I have to enter in the AfterUpdate event I understand. Any additional info you can give me I appreciate. Thanks for your time.
NeoPa 32,557
Recognized Expert Moderator MVP
To set the default value for a checkbox simply open the form in design view; select the checkbox; enter the value required in the 'Default Value' property.
NB. This expects a boolean value - True or False (or Yes; No etc) all work but DON'T require quotes.
Hello,
Thanks for the input you guys give me. I am still not able to get the combo box with the web links to work once an address is selected from the combo box. I did change the Hyperlink property to yes but it did not work. Currently I have a commnad button setup for each web site.
For my main form is there another way I can set it up for the account that is displayed to append to a table after the user makes a selection from a combo box list. I was thinking maybe of creating a one-to-many relationship between the combo box (table) and the main form (query). Once the relationship is created I am not sure what else I will need to do. Any other suggestion I would really appreciated. Thank you all for helping me out.
JC21
Can anyone give me some assistance with problems above. Thanks in advance for any help you can give.
JC21
MMcCarthy 14,534
Recognized Expert Moderator MVP
Hello,
Thanks for the input you guys give me. I am still not able to get the combo box with the web links to work once an address is selected from the combo box. I did change the Hyperlink property to yes but it did not work. Currently I have a commnad button setup for each web site.
For my main form is there another way I can set it up for the account that is displayed to append to a table after the user makes a selection from a combo box list. I was thinking maybe of creating a one-to-many relationship between the combo box (table) and the main form (query). Once the relationship is created I am not sure what else I will need to do. Any other suggestion I would really appreciated. Thank you all for helping me out.
JC21
Does the hyperlink read
mailto:emailaddress
Hi mmccarthy,
Thanks for helping me with my problems. I was wondering if you or someone could look at this code for me. I received this error when I selected an option from the Combo box. Error
Run-time error '3134':
Syntax error in INSERT INTO statement Code:
Private Sub ComboActivity_AfterUpdate()
'assuming all values are available on the form
DoCmd.RunSQL "INSERT INTO Tbl_AcctActivityWcodes (Acct#, Patient Name, Acct Bal, Activity_code) " & _
"VALUES (" & Me.[Acct#] & ",'" & Me.[PATIENT NAME] & "','" & Me.ComboActivity & "')"
'assuming acct# is the primary key i.e. no duplicate values
DoCmd.RunSQL "UPDATE [Qry SP ALL] SET UnAvail=-1 " & _
"WHERE [acct#]=" & Me.[acct_#] & ";"
Me.Requery ' this will requery the form
End Sub
MMcCarthy 14,534
Recognized Expert Moderator MVP
Firstly when trying to outline code use the delimiters.
code in square brackets at the start and /code in square brackets at the end.
It makes it easier to read... -
-
Private Sub ComboActivity_AfterUpdate()
-
-
'assuming all values are available on the form
-
DoCmd.RunSQL "INSERT INTO [Tbl_AcctActivityWcodes] (Acct#, Patient Name, Acct Bal, Activity_code) " & _
-
"VALUES (" & Me.[Acct#] & ",'" & Me.[PATIENT NAME] & "','" & Me.ComboActivity & "');"
-
-
'>>> You have four fields and only three values. If both the last values are in the combo box what column are they in?
-
-
'assuming acct# is the primary key i.e. no duplicate values
-
DoCmd.RunSQL "UPDATE [Qry SP ALL] SET UnAvail=-1 " & _
-
"WHERE [acct#]=" & Me.[acct_#] & ";"
-
Me.Requery ' this will requery the form
-
-
End Sub
-
Hi mmccarthy,
Forgive me but I did not completely understand the question. What I want to do is have the acct#, Pt name, Acct balance and the option selected from the combo box to be transferred to the table. What changes do I need to make in the code for this work?
Thanks,
JC21
MMcCarthy 14,534
Recognized Expert Moderator MVP
Hi mmccarthy,
Forgive me but I did not completely understand the question. What I want to do is have the acct#, Pt name, Acct balance and the option selected from the combo box to be transferred to the table. What changes do I need to make in the code for this work?
Thanks,
JC21
Leaving the syntax code off for the moment, you have the following
INSERT INTO [Tbl_AcctActivityWcodes]
(Acct#, [Patient Name], [Acct Bal], Activity_code)
VALUES (Me.[Acct#] , Me.[PATIENT NAME], Me.ComboActivity)
So you are trying to put Me.[Acct#] to Acct#. That's fine
Then you are trying to put Me.[Patient Name] to Patient Name. You can't have gaps in field names by the way so enclose these with square brackets which will probably solve your error.
The problem is you now have two more fields:
[Acct Bal] and Activity_code
but in the values list you only have one value Me.ComboActivity. Which one do you want this to go into and where is the other value to come from?
I think I got it now, I forgot to create a value for the [acct bal]. the [activity code] is suppose to go with Me.ComboActivity. Hopefully that makes sense.
Thanks,
JC21
MMcCarthy 14,534
Recognized Expert Moderator MVP
I think I got it now, I forgot to create a value for the [acct bal]. the [activity code] is suppose to go with Me.ComboActivity. Hopefully that makes sense.
Thanks,
JC21
Yes it does.
Just put square brackets around the field names that have spaces and add a new value for [acct bal] and it should work alright.
Ok I made progress but right before it was going to append the acount I received this error. Error:
Runtime erro '3073'
Operation must use an updateable query Code
Private Sub ComboActivity_AfterUpdate()
'assuming all values are available on the form
DoCmd.RunSQL "INSERT INTO Tbl_AcctActivityWcodes([Acct_#],[PT_Name], [Acct_Balance], [Activity_code]) " & _
"VALUES (" & Me.[acct#] & ",'" & Me.[PATIENT_NAME] & "','" & Me.[ACCT_BAL] & "','" & Me.ComboActivity & "')"
'assuming acct# is the primary key i.e. no duplicate values
DoCmd.RunSQL "UPDATE [Qry SP ALL] SET UnAvail=-1 " & _
"WHERE [Acct_#]=" & Me.[acct#] & ";"
Me.Requery ' this will requery the form
End Sub
Is there anyway to bypass the Microsoft Access warning 'You are about to append 1 row(s)'
Thank you,
JC21
MMcCarthy 14,534
Recognized Expert Moderator MVP Error:
Runtime erro '3073'
Operation must use an updateable query
The problem this time is with this query. It's not updateable. Can you post the query [Qry SP ALL] in full and I'll have a look at it.
'assuming acct# is the primary key i.e. no duplicate values
DoCmd.RunSQL "UPDATE [Qry SP ALL] SET UnAvail=-1 " & _
"WHERE [Acct_#]=" & Me.[acct#] & ";"
Is there anyway to bypass the Microsoft Access warning 'You are about to append 1 row(s)'
Yes put
DoCmd.SetWarnings False
at the beginning of your code to turn them off and
DoCmd.SetWarnings True
at the end of your code to put them back on.
Here is the SQL code for [Qry SP ALL]. I think this is what you meant by posting it. code:
SELECT [Tbl PATRIALS].ID, [Tbl PATRIALS].[ACCT#], [Tbl PATRIALS].[MR#], [Tbl PATRIALS].[PATIENT NAME], [Tbl PATRIALS].P, [Tbl PATRIALS].S, [Tbl PATRIALS].[SERV AREA], [Tbl PATRIALS].[ADMIT DATE], [Tbl PATRIALS].[DISCH DATE], [Tbl PATRIALS].[TOTAL CHARGES], [Tbl PATRIALS].[PAT PYMT], [Tbl PATRIALS].[INS PYMT], [Tbl PATRIALS].ADJ, [Tbl PATRIALS].[ACCT BAL], [Tbl PATRIALS].[F/C], [Tbl PATRIALS].[POLICY#], [Tbl PATRIALS].[CAR 1], [Tbl PATRIALS].[CAR 2], [Tbl PATRIALS].[S/C]
FROM [Tbl PATRIALS]
WHERE ((([Tbl PATRIALS].[S/C])="FC"))
ORDER BY [Tbl PATRIALS].[ACCT BAL] DESC;
Sorry for being such a pain.
Thanks again for everything.
MMcCarthy 14,534
Recognized Expert Moderator MVP
You haven't included Unavil in the query so it can't be updated. Just add it to the query and it should run ok.
Here is the SQL code for [Qry SP ALL]. I think this is what you meant by posting it. code:
SELECT [Tbl PATRIALS].ID, [Tbl PATRIALS].[ACCT#], [Tbl PATRIALS].[MR#], [Tbl PATRIALS].[PATIENT NAME], [Tbl PATRIALS].P, [Tbl PATRIALS].S, [Tbl PATRIALS].[SERV AREA], [Tbl PATRIALS].[ADMIT DATE], [Tbl PATRIALS].[DISCH DATE], [Tbl PATRIALS].[TOTAL CHARGES], [Tbl PATRIALS].[PAT PYMT], [Tbl PATRIALS].[INS PYMT], [Tbl PATRIALS].ADJ, [Tbl PATRIALS].[ACCT BAL], [Tbl PATRIALS].[F/C], [Tbl PATRIALS].[POLICY#], [Tbl PATRIALS].[CAR 1], [Tbl PATRIALS].[CAR 2], [Tbl PATRIALS].[S/C]
FROM [Tbl PATRIALS]
WHERE ((([Tbl PATRIALS].[S/C])="FC"))
ORDER BY [Tbl PATRIALS].[ACCT BAL] DESC;
Sorry for being such a pain.
Thanks again for everything.
I’m not sure how to add UnAvail to the query since [Qry SP ALL] is getting all its fields from [Tbl PATRIALS]. Should it be included in the table? I am lost on this one. Please let me know how to add it to the query.
Thanks!
MMcCarthy 14,534
Recognized Expert Moderator MVP
I’m not sure how to add UnAvail to the query since [Qry SP ALL] is getting all its fields from [Tbl PATRIALS]. Should it be included in the table? I am lost on this one. Please let me know how to add it to the query.
Thanks!
UnAvail should be included in [Tbl PATRIALS] if you want to use it as an indicator. Just add it as a True/False type field.
Thank you for all your help mmccarthy. Sorry I took so long to reply back.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Thank you for all your help mmccarthy. Sorry I took so long to reply back.
No problem.
I'm glad you got it working.
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dalan |
last post by:
I have been searching the archives in an effort to discover how to
derive a dual use of a single combo box - so far no go. I found the
piece below which pretty much represents the usage. To...
|
by: Andrew |
last post by:
Hello,
I am trying to create a chart whose underlying query is linked to 2
combo boxes on the same form.
I want to pass the values from the combo boxes into the chart query to
allow the chart...
|
by: sara |
last post by:
Hi
I'm pretty new to Access here (using Access 2000), and appreciate the
help and instruction.
I gave myself 2.5 hours to research online and help and try to get this
one, and I am not getting...
|
by: meganrobertson22 |
last post by:
Hi Everyone-
I have a question about how to add and then use the "All" selection in
a combo box. I am trying to figure out how to:
(1) add "All" as a selection to a combo box and then
(2)...
|
by: LD |
last post by:
Is there a way in Access to store more than one value in a field that has
been selected from a combo box?
For example, if a combo box had three values that you can select, "One",
"Two", and...
| |
by: hmiller |
last post by:
Hey everyone,
I am having a hell of a time trying to set this menu system up. Here's
what I'm trying to do.
Combo Box One; is populated by names under properties "row source"
"Phase 1"...
|
by: visionstate |
last post by:
Hi there,
I am working on a form that uses 3 text boxes and 3 combo boxes.
When any data is entered into any of these, I click a command button
and this requeries a sub query in the form and...
|
by: ChristianC |
last post by:
I have a combo box that is pulling data out of table that I created with possible selections for the users of the database. I also have another table where the data is saved after the user has...
|
by: =?Utf-8?B?ZnJlZGR5?= |
last post by:
I am new to the whole c# thing, I now how to get data from a db into a combo
box. My question is: should I have one table for 5 combo box or have 5 tables
for 5 combo box?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |