473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to run a function (which pings the IP_Address field value) on a continuous report

Hi, I already search on the web but as I'm a beginner in VBA I didn't find the specific answer to my question. In fact I have a DB with Printer and I would like to display a list of them in a continuous form (form not a report sorry for the title) and have a ping status on each row. I already have a function wich ping the IP_Address value and return a True or False. This obviously works well on a form with just one printer and then one IP_Address value, but not in the continuous form where I have a list of IP Addresses. How can I run this function on each IP Address value in the continuous form (in the purpose to get the True/False value if it ping and modify an unbound field to indicate if the printer ping)? I hope it is clear. Thank you very much in advance.
Jun 26 '13 #1

✓ answered by zmbd

Fixed your title per your post.

Your function should refer to the control on your form that has the IP address (say it's named "txt_ctrl_printerip") and be entered into the control source of {unbound control} (say it's named "txt_ctrl_pingstate") so that the entry is something along the lines of =fnc_printer_ping([txt_ctrl_printerip])

10 1584
zmbd
5,501 Expert Mod 4TB
Fixed your title per your post.

Your function should refer to the control on your form that has the IP address (say it's named "txt_ctrl_printerip") and be entered into the control source of {unbound control} (say it's named "txt_ctrl_pingstate") so that the entry is something along the lines of =fnc_printer_ping([txt_ctrl_printerip])
Jun 26 '13 #2
Seth Schrock
2,965 Expert 2GB
You would have to call your Ping function in the query that is the recordsource for the form. This would create another field that would give you your true/false result. However, this has the potential to take a long time to then open the form as it is having to ping each IP address. Just something to consider.
Jun 26 '13 #3
@Seth Schrock
Hi Schrock, thank you for your reply, I open the form from this:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "PrinterReport", acNormal, , sWhere, acFormEdit
sWhere contain the criteria of the request for exemple
Expand|Select|Wrap|Line Numbers
  1. sWhere = "building =" & Chr(34) & building & Chr(34)
to filter all the printer in a specific building, (choosen with a combobox) anyway, my question is could I use this to call the "ping" function (named PrinterOnline) and how? Sorry I just build my code copying from different source but I begin in VBA and probably I ask question seeking in the false way. Thank you very much for your help!
Jun 26 '13 #4
@zmbd
Hi zmbd, thank you for your reply, actually it works well on a form with one record, meaning one IP address, I call the function with this
Dim strPrinter As String
strPrinter = IP_Address.Value
If Not PrinterOnline(strPrinter) Then...

(the function is called PrinterOnline).

On the same form I have some combobox where I can select different criteria as the City or the Building where the printers are and through a button open a continuous form with the list of the printers resulting of the criteria choosen. On this continuous form I will ping each printer.

But even with an easier table, for exemple a list of PCs inside a continuous form, I don't know how call my function as if I do it, I have only the first record line result duplicated on each following lines.

Perhaps Schrock has given the solution but I don't yet understand how to implement it.

Thank you very much for your help!
Jun 26 '13 #5
Rabbit
12,516 Expert Mod 8TB
You can not use an unbound control. You will need to use a bound control for this. Unbound controls can not have different values for different rows.
Jun 26 '13 #6
Seth Schrock
2,965 Expert 2GB
I'm going to assume your function is called PingFunction and that is has one argument that needs passed to it; the IP address. In that case, I will also assume that your query has a field named IP_Address. With all of these names, here is a sample of what the query would need to be.
Expand|Select|Wrap|Line Numbers
  1. SELECT PingFunction(IP_Address) AS PingResult, ...
  2. FROM ...
  3. WHERE ...
This will make the query have a field called "PingResult" that will have the True/False result from your ping function for that record.
Jun 26 '13 #7
zmbd
5,501 Expert Mod 4TB
Rabbit You Confuzzzed me...
Take a simple data calc.
I have two bound fields, call them, "ctrl_tbldate_start" and "ctrl_tbldate_end"
I want the time elapsed between these dates, so I have an unbound control, "ctrl_ub_calcdays" wherein the control source I have =DateDiff("h",[ctrl_tbldate_Start],[ctrl_tbldate_end])
Default view is set for continous forms... this works here in that the elapsed time between the date/time is calculted for each record shown.

So following behind that train... this should still work as I've suggested in #2, indeed, I have several forms that do just this very thing where the function sits in an unbound control and I feed information from the bound field to the function. (I should clear that up a tad in #2 too).
Jun 26 '13 #8
Rabbit
12,516 Expert Mod 8TB
Sorry @zmdb, you're right. I probably just used the wrong terminology. I was referring more specifically to my assumption from what the OP said. That assumption being that they are populating the value of the control through code rather than through the control source.
Jun 26 '13 #9
@zmbd
Thank you very much zmbd! It works fine. So simple (always simple when we know how)that I didn't think it could be done like that. Sorry for the time I did to answered, I only could tested it now. Best Regards!
Jun 27 '13 #10
@Seth Schrock
Thank you Seth for your help, I will try your solution also. As the one of zmbd works I began by the easiest one to implement. Best Regards!
Jun 27 '13 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Randy | last post by:
I built and employment report from the employment table. I then had to add a field to the table. I now need to add that field to the report. I can't seem to be able to do that by clicking on...
13
by: MLH | last post by:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If LaborCost > 0 Then Me!LaborCost.Visible = True If MatlsCost > 0 Then Me!MatlsCost.Visible = True If OtherCost > 0 Then...
11
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is...
5
by: Stuart | last post by:
Hi all, Iv'e got a page that has a mass amount of input fields, all of which require a decimal figure. To make it easier when it comes to inputting data, I'm trying to setup + and - links that...
9
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo...
2
by: jmoore1999 | last post by:
I need to write a t-sql query that will take the value of the previous record into consideration before calculating the current row's new column value... Here's the situation... I have a...
2
by: Coll | last post by:
I have a field that I would like to display on a report only if the value of another field matches a certain criteria. If it does match I need the label & the field value to display (though I'm...
9
by: DAHMB | last post by:
I have a Report in which I have one of the fields set up to launch a form with the On Click event. I would like to have the form launch and auto fill a field with the value of the field clicked in...
2
by: buterfly0707 | last post by:
To Get sum of field in crystal report hi i have some problem while getting the sum of the field. i want to get the sum of one filed fro example Debit. but i want to get this sum according to...
3
by: Daryl Austin | last post by:
I have created a mileage report in access. I created a calculated field called "mileage value" that takes field Mileage x field IRSRate. Each is for a given date field in a table. This works fine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.