473,386 Members | 1,823 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,386 software developers and data experts.

print and use the fields of a temporary query in VBA

hi !
I am a new programer by VBA and know I can't use the fields of a query . my codes are as below :

Expand|Select|Wrap|Line Numbers
  1. Dim mydb As Database
  2. Dim str1 As String
  3. Dim rsttemp As Recordset
  4. Dim qdftemp As QueryDef
  5.  
  6. Private Sub Command1_Click()
  7.  
  8.             Set mydb = OpenDatabase("d:\pm_vb\main_db1.mdb")
  9.  
  10.                      str1 = "select * from users where per_code=" & Text1.Text
  11.                       str1 = str1 + "and per_pass=" & Text2.Text
  12.  
  13.               Set qdftemp = mydb.CreateQueryDef("", str1)
  14.                       If qdftemp.RecordCount <> 0 Then
  15.  
  16.            Text3.Text = qdftemp("per_code")
  17.  
  18.            Else
  19.            Text4.Text = "NO"
  20.             End If
  21.  
  22. End Sub
it would be appreciate if you could help me .

regards, Ali
Feb 15 '07 #1
3 1089
willakawill
1,646 1GB
Hi. Is there any particular reason that causes you to use a querydef or is that just the way you think this process has to be done?
Feb 16 '07 #2
Hi. Is there any particular reason that causes you to use a querydef or is that just the way you think this process has to be done?
Hi , by this way I'm going to control and access the components of a SQL statement . For example checking the user_ID and enterance password of my program and also set them in the forms, as the caption of a lable .
thank you
Feb 17 '07 #3
willakawill
1,646 1GB
I think it would be a good idea for you to work through some tutorials on vb and database projects. This would be a good place to start
Feb 17 '07 #4

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

Similar topics

2
by: Sherwood Botsford | last post by:
I'm new to access. I have an orienteering database that has information about locations all over the map. Each location has 0-N clues I've worked up a report that will print the locations,...
2
by: Lars Netzel | last post by:
Is it hard to make a Print button from a Windows Form that will print a number of fields from an Access database in a fairly formatted way? How does this work with the Print Dialoges and stuff? ...
3
by: S P Arif Sahari Wibowo | last post by:
Hi! I would like to make an editable continous form, where most fields will be from table A and editable, except 1-3 fields are a glimpse into table B and uneditable. Table A relate to table B...
1
by: jj | last post by:
I created a dynamic report and the fields is displayed base on the query. The report contains about 34 fields so if the query has 34 fields, all 34 fields in the report shows up. But if the query...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
2
by: ghat12 | last post by:
Hi, I am trying to print a subform containing approx 50 columns in datasheet view. The printout cannot fit more than 8-10 columns. Does anyone know of any way to print all columns; i don't care...
3
by: Zammy | last post by:
Is there a way to specify different field names in a temporary table created using VBA? I just inherited a program and now the users want to export results to Excel. The original programmer only...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.