查询结果为VB变量 [英] Query Results As VB Variables

查看:60
本文介绍了查询结果为VB变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

祝大家好日子,我制作一个非常简单(或者应该是这样)的数据库,并且我试图做得太难。


背景,我在实验室工作并且数据库的目的是记录试剂水平(如库存控制数据库)我一直在将查询写为vb代码,这样我就可以在事情发生时更改事件等,一切顺利,直到我更多地构建它,我希望用IF命令进行思考,我想要的是例如,IFSQL(VB)代码的结果给我一个结果。那么做其他事情,我做了很多的查找,我一直回到找到唯一的方法来做到这一点是记录集,我真的不能让该死的东西工作,我遵循的例子(适应我的事业当然)我不能得到我想要的结果,我开始希望我已经做了很长的路并使用Excel,哈哈。


我非常感谢任何帮助或指向右边专业人士可以给我的方向。


谢谢

Good day to you all, im making a very simple (or so it should be) database and im trying to do things too difficultly.

Background, i work in a lab and the purpose of the database is to record the reagent levels (like a stock control database) i have been writting queries as vb code so that i can change events etc as things happen and its all going fine, until i build on it more, i want thinks to happen with IF commands, and what i want is for example, IF "the results of an SQL (VB) code gives me a result" THEN do something else, ive done lots of looking up and i keep getting back to finding the only way to do this is with recordsets, well i really cant get the damn things to work, i follow examples (adapting for my cause of course) and i cant get the outcome i want, im beginning to wish i had done it the long way and used Excel, lol.

I would very much appreciate any help or pointing in the right direction you pros could give me.

thanks

推荐答案

丹。


一般来说SQL命令不会不返回任何你可以按照你想要的方式使用VB变量的kinf。用你的代码解释你想要实现的逻辑。


问候,

Fish
Hi, Dan.

Generally SQL command doesn''t return any kinf of VB variable you can use the way you want. Explain the logic you want to implement with the code.

Regards,
Fish


好的谢谢你的回复,有一些我想要做的事情,它们都包括if命令和查询

i可以将查询限制为单个答案''cos the数据库"是这么简单,

(一个表有ID号。试剂名称,批号,有效期,数量和分段分配器(只是为了分解列表)我完成了基本框架和我在vb代码中使用了select,update delete queryies(作为表单上的更新事件等等来限制我的源数据等等等等等等等。


但就像我说我想要的一些if命令。


第一个存在;如果一个试剂正在接近一个低数字,那么我想要一个msgbox弹出并说嘿伙计,我很饿(或类似) lol)基于ID#和> 5的简单查询,例如,
另一个用于删除查询,我想运行一个或另一个更新查询,然后删除,所以我需要另一个IF。


和列表中的新内容是这样我可以有一个复选框字段来显示该项目是否正在使用中(与之相关)批号和使用旧东西1号!)


所以我只需要知道如何g从sql,cant fathom记录集中输出的值,并且有一个答案我不确定它是否值得?我试着制作一个查询并选择数据(qryxyz。[blah1] .value = x ...等...)


对不起长时间阅读,但你能提供的任何东西都是最有帮助的。
OK thanks for the reply, there is a few things i want to do and they all include if commands, and queries
i can limit the queries to single answers ''cos the "database" is so simple,
(one table with ID num. Reagent name, batch number, expiry, quantity, and a section splitter (just to break up the list a bit) i have the basic frame done and i have used select, update delete queryies in vb code (as update events and so on on forms to get my source data restricted and so on blah blah.

but like i say i want some if commands.

the first being; if a reagent is aproaching a low number, then i want a msgbox to pop up and say "hey dude, im hungry" (or similar lol) so simple query based on the ID # and >5 for example,

another is for the delete query where i want to run either one or another update query followed by the delete, so i need another IF.

and the newsest to the list is so that i can have a checkbox field to show weither or not the item is in use yet or not (relating to batch numbers and using old stuff 1st!)

so i just need to knw how to get the value out from sql, cant fathom recordset, and with one answer im not sure it would be worth it?? and i tried just "making" a query and selecting the data (qryxyz.[blah1].value = x... etc...)

sorry for the long read but anything you can give would be most helpful.



好​​的感谢回复,有一些我想做的事情,它们都包含if命令和查询

i可以将查询限制为单个答案''cos the数据库是这么简单,

(一个表有ID号。试剂名称,批号,有效期,数量和分段分配器(只是为了分解列表)我完成了基本框架和我在vb代码中使用了select,update delete queryies(作为表单上的更新事件等等来限制我的源数据等等等等等等等。


但就像我说我想要的一些if命令。


第一个存在;如果一个试剂正在接近一个低数字,那么我想要一个msgbox弹出并说嘿伙计,我很饿(或类似) lol)基于ID#和> 5这么简单的查询,例如,
OK thanks for the reply, there is a few things i want to do and they all include if commands, and queries
i can limit the queries to single answers ''cos the "database" is so simple,
(one table with ID num. Reagent name, batch number, expiry, quantity, and a section splitter (just to break up the list a bit) i have the basic frame done and i have used select, update delete queryies in vb code (as update events and so on on forms to get my source data restricted and so on blah blah.

but like i say i want some if commands.

the first being; if a reagent is aproaching a low number, then i want a msgbox to pop up and say "hey dude, im hungry" (or similar lol) so simple query based on the ID # and >5 for example,



你不想简单地弹出查询窗口或表格基于查询

Don''t you want to simply popup a query window or form based on the query

展开 | 选择 | Wrap | 行号


这篇关于查询结果为VB变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆