You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old February 24th, 2021, 02:16 PM   #16
parky
Member
United Kingdom

parky is online now
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,143
you must make sure the data types are correct.
You need to format the Date

Dim My_Date as variant
My_date = "'" + Format(Date,"yyyy-mm-dd") + "'"
Dim My_Tag1, My_Tag2 as integer (note it depends on types)
Then your variables need to be the same i.e. string, integer etc. unless you have made them all strings
I also suggest you copy the PLC values to variables
My_Tag1 = PLC_Tag1
My_Tag2 = PLC_Tag2

datastring = "INSERT INTO TBL_YYY (AAA, BBB, CCC) VALUES (" & My_Date & ", " & My_Tag1 & ", " & My_Tag22 & " ) "

Conn1.Open
Conn1.Execute datastring
Conn1.Close

Note there are spaces between the " & yours does not show the spaces these are important, also I have incorporated it all into the datastring then you execute it As I said the string has to be absolutely right
  Reply With Quote
Old February 24th, 2021, 02:35 PM   #17
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,661
Quote:
Originally Posted by curlyandshemp View Post
All I can say is, the is the kind of stuff where Induction Automation's Ignition is light years ahead of all the others.
if you need to get stuff in and out of a SQL database, Ignition is the way to go.



Apparently there is also an easier way to do this in FTV/SE, without using VB:




https://www.youtube.com/watch?v=oEw0ik3laww
  Reply With Quote
Old February 24th, 2021, 02:37 PM   #18
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
No....
MsgBox("FFP") show a message box normally with FFP but MsgBox(FFP) shows a empty box but without error

I guess that BD_SETPOINTs tags must be referenced in vba "joined" with PLC tags.
That's what I have to do and I don't know how
  Reply With Quote
Old February 24th, 2021, 02:45 PM   #19
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
This way is even easier, but I won't be able to update the lines I need to do
  Reply With Quote
Old February 24th, 2021, 02:59 PM   #20
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,661
Quote:
Originally Posted by FFP View Post
No....
MsgBox("FFP") show a message box normally with FFP but MsgBox(FFP) shows a empty box but without error

I guess that BD_SETPOINTs tags must be referenced in vba "joined" with PLC tags.
That's what I have to do and I don't know how



http://www.plctalk.net/qanda/showthread.php?t=102555


?
  Reply With Quote
Old February 24th, 2021, 03:13 PM   #21
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
The general problem is that VB is not able to "see" the PLC tags
  Reply With Quote
Old February 24th, 2021, 03:55 PM   #22
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,661
Quote:
Originally Posted by FFP View Post
The general problem is that VB is not able to "see" the PLC tags

Look at the last link I sent, especially the first post that uses something like this


also https://www.google.com/search?q=vba+...w+taggroup+tag



Code:
Dim WithEvents Ogroup As TagGroup
Dim A_Tag as Tag

  Ogroup.Add "[PLC1]A_Tag"
  A_Tag = Ogroup.Item("{[PLC_1]A_Tag}")

  MsgBox(A_Tag.Value)   ''' N.B. upper-case V

Last edited by drbitboy; February 24th, 2021 at 04:00 PM.
  Reply With Quote
Old February 24th, 2021, 04:39 PM   #23
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
New Errors
Attached Images
File Type: jpg WhatsApp Image 2021-02-24 at 18.36.26.jpg (60.4 KB, 7 views)
File Type: jpg WhatsApp Image 2021-02-24 at 18.35.53.jpg (69.9 KB, 5 views)
  Reply With Quote
Old February 24th, 2021, 05:12 PM   #24
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,661
look at the links I sent. you need to add


Code:
Set Ogroup = Application.CreateTagGroup(Me.AreaName)

or summat like that, before the first .Add
  Reply With Quote
Old February 25th, 2021, 03:36 AM   #25
parky
Member
United Kingdom

parky is online now
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,143
I have not used FT but in the older RSV32 logging to databases was easy, just triggers to log data, however, I think update command was not one of the commands so would have to use VB.
  Reply With Quote
Old February 25th, 2021, 05:56 AM   #26
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
New Error
Attached Images
File Type: jpg WhatsApp Image 2021-02-25 at 07.52.34.jpg (87.2 KB, 33 views)
  Reply With Quote
Old February 25th, 2021, 08:08 AM   #27
rdrast
Lifetime Supporting Member
United States

rdrast is offline
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 5,498
First, your Group.Add item should be in braces:


Group.Add "{[IOTOPIC]TagName}"


Also, when reading an item, use Set:


Set MyTag = Group.Item("{[IOTOPIC]TagName}")
__________________
------------------------------------
How to ask questions the SMART Way!

Look First, Ask Second!

  Reply With Quote
Old February 25th, 2021, 11:28 AM   #28
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
Error again
Attached Images
File Type: jpeg WhatsApp Image 2021-02-25 at 13.26.31.jpeg (80.5 KB, 27 views)
  Reply With Quote
Old February 25th, 2021, 11:33 AM   #29
FFP
Member
Brazil

FFP is offline
 
Join Date: Feb 2021
Location: Brazil
Posts: 24
New Error
Attached Images
File Type: jpeg WhatsApp Image 2021-02-25 at 13.33.10.jpeg (163.5 KB, 29 views)
  Reply With Quote
Old February 25th, 2021, 12:39 PM   #30
parky
Member
United Kingdom

parky is online now
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,143
Not sure if this helps but in excel this is typical problem.
An automation error could occur when you are referring to a workbook or worksheet via a variable, but the variable is no longer active. Make sure any object variables that you are referring to in your code are still valid when you call the property and methods that you are controlling them with.
Can you set break points in the VB & step through it to find which one is causing the error ?.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Deployment of a Data Server in the Galaxy (ArchestrA IDE) NathBarreiros LIVE PLC Questions And Answers 2 January 31st, 2021 10:16 AM
FactoryTalk Studio Alarm Issue Sham LIVE PLC Questions And Answers 10 April 2nd, 2020 05:36 PM
FTView SE - unable to delete application or add network server phuz LIVE PLC Questions And Answers 4 June 9th, 2017 08:00 AM
FTView Datalogging to SQL Express. How to purge database MorphuisOGrady LIVE PLC Questions And Answers 5 September 5th, 2016 04:57 PM
Data Trends Not Always Appearing (FTView SE) jfd7851 LIVE PLC Questions And Answers 0 March 1st, 2016 04:11 PM


All times are GMT -4. The time now is 10:23 AM.


.