|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
2 Value assign to one Ado
/*Note: PageDB has been assigned to AdoPageDB
How can i make my Ado to able to have the 2 value of AlarmtableDyna and UserDyna? Since i know that i can't just AdoPageDB.Recordset = SQL because the UserDyna's value will overright AlarmtableDyna's value. SQL = "SELECT * FROM AlarmTable WHERE AlarmTable.AlarmID = " SQL = SQL + Str(i + 1) Set AlarmtableDyna = PageDB.OpenRecordset(SQL) SQL = "SELECT * FROM UserTable WHERE UserTable.AlarmGroup = " SQL = SQL + Str(AlarmtableDyna.Fields(2)) + " AND UserTable.OnCall = True " Set UserDyna = PageDB.OpenRecordset(SQL) |
|
#2
|
|||
|
|||
|
Well first that is not ADO it's DAO. Second you should use CStr instead of Str to convert to a string. if you want two different tables then having two recordsets is normal. unless you want to combine the tables.
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
okie.. but how do i make it such that i dun need to assign 2 variable but it will noe which value's i want it
|
|
#4
|
|||
|
|||
|
i'm not sure what you mean. what's wrong with having two variables? what do you mean by values?
|
|
#5
|
|||
|
|||
|
just to cut down the amount of variable used.
Such know the value i need for 2 different values with the same table the coding is below: SQL = "SELECT * FROM AlarmTable WHERE AlarmTable.AlarmID = " SQL = SQL + Str(101) AdoPageDB.RecordSource = SQL AdoPageDB.Refresh Set AlarmtableDyna = AdoPageDB.Recordset SQL = "SELECT * FROM UserTable WHERE UserTable.AlarmGroup = " SQL = SQL + Str(AlarmtableDyna.Fields(2)) + " AND UserTable.OnCall = True " AdoPageDB.RecordSource = SQL AdoPageDB.Refresh Set UserDyna = AdoPageDB.Recordset |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > 2 Value assign to one Ado |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|